In my application a user can upload a word template and we generate a report using the uploaded template (using CreateDocxFromTemplate($file)).
Now I need to clear all the content from the template.
How can this be accomplished?
🏷️ Limited Offer: 25% OFF 🏷️
First 100 purchases only — Special discount!
Use this coupon on checkout: PHPDXPJ_D1SC1N5T
Get it nowIn my application a user can upload a word template and we generate a report using the uploaded template (using CreateDocxFromTemplate($file)).
Now I need to clear all the content from the template.
How can this be accomplished?
Hello,
We recommend you to don't overwrite the template. Phpdocx doesn't change the original template unless you overwrite it.
For example, this code:
$docx = new CreateDocxFromTemplate('TemplateSimpleText.docx');
$first = 'PHPDocX';
$variables = array('FIRSTTEXT' => $first);
$docx->replaceVariableByText($variables, $options);
$docx->createDocx('output'); generates a new DOCX file, output.docx, without changing the template.
Regards.