When generating a file from a word template, is it possible to delete personal data left in the template? For example, the author's name.
I checked if the author's name is left in the template, in the new files received based on this template, this author's name is copied, which is not correct, because is personal data.
I have a lot of templates and it’s problematic to manually delete personal data from them; they are also often edited and sometimes you forget to delete this data from them.
I found answer based on comment from @C3roe:
$templateProcessor = new TemplateProcessor($templateFileLink);
$templateProcessor->saveAs($resultFileLink);
$objReader = \PhpOffice\PhpWord\IOFactory::createReader('Word2007');
/** @var PhpWord $phpWord */
$phpWord = $objReader->load($resultFileLink); // instance of \PhpOffice\PhpWord\PhpWord
/** @var DocInfo $properties */
$properties = $phpWord->getDocInfo();
$properties->setCreator('');
$properties->setModified(false);
$properties->setLastModifiedBy('');
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save($resultFileLink);