Escape ampersand in PHPWord docx documents
If you are trying to output documents to DOCX using PHPWord and you are getting broken files due to there being ampersands in your source, then the fix is simple.
It’s talked about in this locked GitHub issue:Â https://github.com/PHPOffice/PHPWord/issues/514
That issues mentions that it’s been resolved inÂ https://github.com/PHPOffice/PHPWord/issues/483
Neither issues helpfully link you to the documentation which tells you how to resolve your issue!
PHPWord Output Escaping:Â http://phpword.readthedocs.io/en/latest/general.html#output-escaping
No more broken unescaped ampersands littering the xml in your docx.
Hope that helps,