Closed helderneves91 closed 5 months ago
You need to enable the escape characters feature. Don't know why it is not enabled by default. In vendor\phpoffice\phpword\src\PhpWord\Settings.php set outputEscapingEnabled to true and it should work.
You need to enable the escape characters feature. Don't know why it is not enabled by default. In vendor\phpoffice\phpword\src\PhpWord\Settings.php set outputEscapingEnabled to true and it should work.
Ahh ok, I get it. After searching the docs I found that it's desabled by default for backward compatibility. We should not mess with vendor folders.
Fixed by using:
// Load template into PhpOffice\PhpWord
$template = Storage::disk('orbiapps_sgc')->path('templates/'.$template->file);
\PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);
$template = new TemplateProcessor($template);
Thanks for the guidance!
Describe the Bug
I have a word that has variables to be replaced. If the text has an &, the word is created with errors, giving the error xml parsing error.
Steps to Reproduce
Please provide a code sample that reproduces the issue.
Context
Please fill in your environment information: