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.
require_once('../../../tools/4.6/lib/log4php/Logger.php');
require_once('../../../tools/4.6/classes/CreateDocx.inc');
$docx = new CreateDocxFromTemplate('TemplateExternalFile.docx');
$docx->replaceVariableByExternalFile(array('EXTERNAL' => 'External.docx'), array('matchSource' => true));
$docx->createDocx('example_replaceVariableByExternalFile_1');
// In output file variable EXTERNAL is empty.
//Executed in CLI with php version 5.3.18 and 5.5.9. There are no errors. In browser not working too.
Hello,
The method works perfectly, but be aware that this method uses the altchunk. As explained in the documentation this tag is supported only by MS Word 2007 and newer, and only with Windows.
Regards.
I'm working on linux and use libre office, my customer using iOS :)
I need to replace a variable in the template table as advise to do it? Table is created using addTable.
Hello,
You can use one of these methods: replaceListVariable, replaceTableVariable, replaceVariableByHtml, replaceVariableByText or replaceVariableByWordFragment.
If you need to merge the DOCX you can use the MultiMerge but it's only available for the Corporate and Enterprise licenses.
Regards.