You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
Hi when using the template processor and the setName function e.g
Saving as a doc 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
above it is required
The text was updated successfully, but these errors were encountered: