Skip to content
New issue

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

Special Characters, cause xml problems #671

Closed
rhousham opened this issue Nov 27, 2015 · 2 comments
Closed

Special Characters, cause xml problems #671

rhousham opened this issue Nov 27, 2015 · 2 comments

Comments

@rhousham
Copy link

Hi when using the template processor and the setName function e.g
Saving as a doc file.

        $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($template);
        $templateProcessor->setValue('SOMETEXT',$text);
       $templateProcessor->saveAs($file);

You need to htmlspecialchars the $text because otherwise if it contains a & or presumably other special chars this will break the file and you cannot open it. (unless you want to go through the faff of turning into a zip file, finding the & in the document.xml and changing it to & a m p; ! )

So hence

       $text = htmlspecialchars($text);

above it is required

@gmta
Copy link
Contributor

gmta commented Jan 11, 2016

Please see the following issues for a more detailed insight on this topic:

I am positive that you will be able to solve the issue using the information provided above. Good luck!

@ghost
Copy link

ghost commented Jul 9, 2016

Hi, @rhousham.
This is resolved in scope of #483. The changes are currently available in develop branch.

Thanks for the feedback.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants