Forum


Replies: 5   Views: 4312
Lib throws exception when including variables containing & and parselinebreaks set to true
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by jdespatis  · 15-07-2014 - 13:00

I'd like to include breaks in my word file, so I use following code: $docx = new \CreateDocxFromTemplate("replacePlaceholderImages1.docx"); $docx->replaceVariableByText(array("FOO" => "some & text \n foo"), array("target" => "header", "parseLineBreaks" => true)); $docx->createDocx('/tmp/example_replacePlaceholderImages_1'); But I get an exception: ContextErrorException: Warning: DOMDocument::createElementNS(): unterminated entity reference text in [...]/phpdocx/classes/CreateDocxFromTemplate.inc line 1297 Exception seems due to the presence of '&' symbol