Iff you have additional content in a docx document, you can append it using a variable that call this document and place the text inside where you define the variable.

This is the code:
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addTemplate('../files/TemplateText.docx');
$docx->addTemplateVariable('WEIGHT1', '10');
$docx->addTemplateVariable('WEIGHT2', '20');
$docx->addTemplateVariable('WEIGHT3', '25');
$docx->addTemplateVariable('PRICE1', '5');
$docx->addTemplateVariable('PRICE2', '30');
$docx->addTemplateVariable('PRICE3', '7');
$docx->addTemplateVariable('TOTALWEIGHT', '55');
$docx->addTemplateVariable('TOTALPRICE', '42');
// Add the content of the document when $NAME$ variable is called.
$docx->addTemplateVariable('NAME', '../files/Text.docx', 'docx');
$docx->createDocx('template_docx_text');
If you enjoyed this post you might want to subscribe to our RSS Feed!


