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.
I have a problem when I generate a document, if there is at least one word with the character ampersand (&) the document crash and doesn't open, I tested in the sample form of the section Demo of this site and it's crashed too, here is an example for your test, please help me and sorry for my english is not very well.
$paramsHeader = array(
'font' => 'Humnst777 BT',
'b' => 'single',
'color' => '008000',
'jc' => 'center',
'sz' => 13
);
$docx = new CreateDocx('doc');
$docx->setEncodeUTF8();
$docx->addText('Testing & character', $paramsHeader);
$docx->createDocx('sample');
Hi,
This is also a problem with the PRO version.
Having ampersand within any variable will crash the document beyond usability.
I've solved the issue by replacing the ampersand with & before calling addTemplateVariable.
IMHO all XML reserved characters will crash the document like < or >.
Looking forward for a small update to resolve the issue.
Kind regards,
Gregor Streng
Hi,
You have to replace the '&' character with his HTML equivalent &# 38; (without spaces). Here you have a conversion table http://www.asciitable.com
Or entering the parameter value within a CDATA section
[code]$docx->addText(’<![CDATA[Testing & character]]>’, $paramsHeader);[/code]
Regards.
Thanks a lot, it's work excellent