Forum


Replies: 1   Views: 280
Ampersand bug
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpxlsx 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 phpxlsx version and check the Documentation available.

Posted by admin  · 14-10-2022 - 08:16

Hello,

All methods that add contents apply the htmlspecialchars automatically to convert special characters. The replaceVariableText doesn't apply htmlspecialchars automatically to the new values. A patch to apply htmlspecialchars in replaceVariableText values has been added into the testing branch to be included in the stable release.

Using the current stable release, please apply it manually:

$xlsx->replaceVariableText(array('val1' => htmlspecialchars('Hi & Welcome')));

Regards.