We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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); }
/**
* @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);
$replace = $this->xmlEscape($replace);
The text was updated successfully, but these errors were encountered:
Actually you may just call setValue as it done in samples setValue('some',htmlspecialchars($some));
Sorry, something went wrong.
#671 (comment).
@pv451 I don't agree. Take an example, ¢£¥€§©®™×÷ these character shouldn't be converted to html entities. Only "'&<> should be converted. htmlentities() is not suitable. str_replace()is better.
¢£¥€§©®™×÷
"'&<>
No branches or pull requests
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);
The text was updated successfully, but these errors were encountered: