-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Version 1.2.0 - Xml parsing error because of "&" char #2553
Comments
You need to enable the escape characters feature. Don't know why it is not enabled by default. |
Ahh ok, I get it. After searching the docs I found that it's desabled by default for backward compatibility. 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.
![xml parser](https://private-user-images.githubusercontent.com/11777337/297425271-b1095dc8-b779-41d1-8880-1400a0db5026.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTg5NDc5NDYsIm5iZiI6MTcxODk0NzY0NiwicGF0aCI6Ii8xMTc3NzMzNy8yOTc0MjUyNzEtYjEwOTVkYzgtYjc3OS00MWQxLTg4ODAtMTQwMGEwZGI1MDI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIxVDA1MjcyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThjZTRlMmE2MjRhZDBjNzViMjEzMmU2YmIwMTAyOTQ4OWE2YTE5M2FlY2E3MDRhNjdmNjk0ZGYyNzU4NTA5YTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.E_IHe5y2tzoKDa9ls7vePWNeXknNYS55AgU00x9AvEI)
Steps to Reproduce
Please provide a code sample that reproduces the issue.
Context
Please fill in your environment information:
The text was updated successfully, but these errors were encountered: