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

'Semicolon missing' in saved docx file #1367

Closed
BBalazsJurgen opened this issue May 9, 2018 · 2 comments
Closed

'Semicolon missing' in saved docx file #1367

BBalazsJurgen opened this issue May 9, 2018 · 2 comments

Comments

@BBalazsJurgen
Copy link

BBalazsJurgen commented May 9, 2018

Dear Dev Team,

We are using PHPWord to generate a number of docx files - we are using PHPWord to generate the file from scratch, the main body of the document remains the same, and we are only changing certain elements like tables and parts of text in paragraphs.

Most of the documents generated work just fine, but a few seem to have issues. When trying to open a file, Word replies with the following message (rough translations, might not be accurate):

"We're sorry. We can't open the file [filename] because we found a problem with its contents."
Clicking "Details" provides us with the following information:
"Semicolon required. Location: Part: /word/document.xml, Line: 2, Column: 62564".

I have attached the file in question for reference.
Removed

Please get back to us with anything you can find.

Kind regards,
BBalazs

@rkorebrits
Copy link

image

You need to escape ampersands. You can either use htmlspecialchars or \PhpOffice\PhpWord\Settings::setOutputEscapingEnabled(true);

@BBalazsJurgen
Copy link
Author

Thanks for the speedy reply, the solution worked flawlessly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants