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.

docxdocumenttetemplate.png

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');