Closed
Description
Hi when using the template processor and the setName function e.g
Saving as a doc file.
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($template);
$templateProcessor->setValue('SOMETEXT',$text);
$templateProcessor->saveAs($file);
You need to htmlspecialchars the $text because otherwise if it contains a & or presumably other special chars this will break the file and you cannot open it. (unless you want to go through the faff of turning into a zip file, finding the & in the document.xml and changing it to & a m p; ! )
So hence
$text = htmlspecialchars($text);
above it is required