Hello,
Thanks for sending the template and the code you are using. The problem is that you are using the following line:
$docx = new CreateDocx('../web/template/template.docx');
and to load a template you need to use
$docx = new CreateDocxFromTemplate('../web/template/template.docx');
This way of loading the template is the recommended one from phpdocx 4 (you can check the included samples in phpdocx 7 too). The first option of CreateDocx:
/**
* Constructor
*
* @access public
* @param string $baseTemplatePath. Optional, phpdocxBaseTemplate.docx as default
* @param $docxTemplatePath. User custom template (preserves Word content)
*/
public function __construct($baseTemplatePath = PHPDOCX_BASE_TEMPLATE, $docxTemplatePath = '')
is only for specific base templates (to overwrite default templates in the DOCX) and should never be used but in very specific cases. Since phpdocx 4, the way to load a template is using CreateDocxFromTemplate (otherwise you can't use template methods): https://www.phpdocx.com/documentation/practical/working-with-templates
Regards.