Replies: 2   Views: 2583
Adding an external docx file does not work
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by davelavinsky  · 07-03-2018 - 18:07

I tried with the simplest example here :

require_once 'config.php';
require_once CB_DIR_3DP.'phpdocx-corporate-5.5/classes/';

$docx = new CreateDocx();

$docx->addExternalFile(array('src' => 'Text.docx'));


But the output file (example_addExternalFile) just contains



Posted by admin  · 07-03-2018 - 18:33

Posted by admin  · 08-03-2018 - 13:11


Those methods are fully tested and they work&nbsp;perfectly as you can check running the included samples and opening the DOCX with MS Word 2007 or newer. But, as you can read on the documentation pages (

altChunk tag: The addExternalFile and replaceVariableByExternalFile methods use the Word altChunk internal tag. This allows to insert external files in a Word document. This tag is MS Word supported only, so it's not compatible with the conversion plugin.

And the API method ( also explains it:

This method is not compatible with the conversion plugin: the inserted docx will not render at all in the resulting PDF, DOC, RTF, ODT or HTML document.

These methods use altChunk tags that are only supported by MS Word 2007 or newer on Windows. But they aren't supported by LibreOffice, MS Word on macOS, MS Word 2003, Google Docs and others.

If you need to add an existing DOCX to any point of another DOCX, please check the following documentation:

Please note you need to use phpdocx 6.5 or newer.