Skip to content

Escape invalid XML characters when reading in a Word2007 file #722

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

Closed
wants to merge 1 commit into from
Closed

Escape invalid XML characters when reading in a Word2007 file #722

wants to merge 1 commit into from

Conversation

tjarrett
Copy link
Contributor

@tjarrett tjarrett commented Feb 2, 2016

This fix resolves issue #720 in which reading in and then immediately saving a Word2007 file fails if there are any invalid XML characters in the document.

I realize it is the user's responsibility to escape content when using the Writer (and actually agree with this stance), but it feels like it is this library's responsibility to do so when reading in a document.

To test this I fed xml-characters-in.docx into PHPWord using this code:

$test = \PhpOffice\PhpWord\IOFactory::load('xml-characters-in.docx');
$test->save('xml-characters-out.docx');

And the result is the attached file xml-characters-out.docx.

@troosan
Copy link
Contributor

troosan commented Mar 20, 2018

merged manually

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

Successfully merging this pull request may close these issues.

2 participants