Posted by Tommy@Nsure ·
Deleted by Tommy@Nsure ·
05-02-2025 - 12:56
Hello,
What license and version of phpdocx are you using?
We recommend you read the following documentation pages:
Your DOCX contains the symbol used to wrap placeholders ($) a regular content (such as $$PFEE_AMT$ ). Therefore, methods that detect the variables automatically (such as getTemplateVariables) can't get them correctly.
We recommend you doing one of the following approaches:
$docx = new CreateDocxFromTemplate('sample.docx', array('parseMode' => true));
CreateDocxFromTemplate::$regExprVariableParse = '(.+)';
print_r($docx->getTemplateVariables());
We recommend you use ${} to wrap placeholders, that is the more accurate and easiest approach for your template. After updating your template using ${} you can get all template variables as needed:
$docx = new CreateDocxFromTemplate('sample.docx');
$docx->setTemplateSymbol('${', '}');
print_r($docx->getTemplateVariables());
Regards.