使用php合并多个word文件。
已将其放在本站git
请见:https://git.2iwm.com/isle/phpMergeDocx
使用:
$dir = 'C:\\www\\docx\\';
// Docx template
$docx = \Jupitern\Docx\Docx::instance()
->setTemplate($dir.'template.docx')
->setData(['{name}' => 'john doe', '{address}' => 'at the end of the road'])
->save($dir.'result.docx');
// Merge Docx files
$docxMerge = \Jupitern\Docx\DocxMerge::instance()
// add array of files to merge
->addFiles([$dir.'file1.docx', $dir.'file2.docx'])
// output filepath and pagebreak param
->save($dir.'result.docx', true);