Closed
Description
PHPWord Version 0.12.0
Setting a value with an & in the string will cause Word to think the document is corrupt.
Add the below function to TemplateProcessor.php:
/**
* @param string $string
* @return string
*/
private function xmlEscape($string) {
return str_replace(array('&', '<', '>', '\'', '"'), array('&', '<', '>', ''', '"'), $string);
}
Add this to the first line of public function setValue in TemplateProcessor.php:
$replace = $this->xmlEscape($replace);