DocxMerge
DocxMerge copied to clipboard
Merged document only contains first document
I ran the following code using your example as a template:
<?php
require("DocxMerge.php");
$dm = new DocxMerge();
$dm->merge( [
"doc2.docx",
"doc1.docx"
], "result.docx" );
?>
result.docx only winds up containing the material from the first docx file (in this case doc2.docx). PHP version 5.5.24 (cli)
Same problem here.
In Microsoft Word (2007, sorry not tested other) the whole document shows. BUT when you open the docx file with LibreOffice/OpenOffice it only views the first page. When I use the version of Jupiter, with the page breaks, It shows the first page and all the rest of the pages blank.
Say you have a merge of 100 docx files, you only get the first page with content and 99 blank pages.
I tried everything. Can someone take a look at this?
This is a visualisation of how docxmerge works: [xml first-doc] text of the firstdoc [include second-doc.zip /] ... [/xml]
It's not a true merge, just includes. The "include a zip" method isn't supported by LibreOffice or patched Word 2003.
Is there any solutiuon for that trouble?
I found a $599 librarie that does the job.
Same problem here
$files = glob($path.'*'); $dm = new DocxMerge(); $dm->merge( $files, "uploads/merge/result.docx" );
But return only one file
+1 For this issue.
Same here
+1
``krustnic/docx-merge/src/DocxMerge/Docx.php line217
rename($tempFile, $this->docxPath);
replace with //通过win->虚拟机中的rename产生'Operation not permitted'报错,走copy unlink //不报错 则走rename if(!rename($tempFile, $this->docxPath)){ copy( $tempFile, $this->docxPath ); unlink($tempFile); }
found this solution https://stackoverflow.com/a/7960164/887100
I have done this project https://github.com/JohannCOSTE/phpMergeDocx based of @yujin1st comment. It works for LibreOffice but not for last MS Word version if someone have a solution it would be great!