Forum


Replies: 2   Views: 1065
Problems with character & in bulkprocessing
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 admin  · 17-03-2021 - 15:13

Hello,

Thanks for sending the sample that illustrates the issue. The current version of BulkProcessing doesn't apply htmlspecialchars to the new contents automatically (other methods of phpdocx apply this function automatically), so the strings that contains & don't appear, you can solve it applying htmlspecialchars to the contents to be added:

$bulk->replaceText(
  [
    ["PLACEHOLDER" => htmlspecialchars("test & test")],
    ["PLACEHOLDER" => htmlspecialchars("test&")],
    ["PLACEHOLDER" => htmlspecialchars("&")],
    ["PLACEHOLDER" => "test test"]
  ]
);
$documents = $bulk->getDocuments();

We have opened a task to apply htmlspecialchars automatically in the next version of BulkProcessing class.

Regards.