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?
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?
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.