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: 20% OFF on licenses purchased until March 31st
Use this coupon on checkout: PHPDPX_3KUI3AN0TP
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.