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

unreadable file content generated using template processor #681

Closed
johnhuichen opened this issue Dec 6, 2015 · 0 comments · Fixed by #1269
Closed

unreadable file content generated using template processor #681

johnhuichen opened this issue Dec 6, 2015 · 0 comments · Fixed by #1269

Comments

@johnhuichen
Copy link

johnhuichen commented Dec 6, 2015

Hi, my problem is with using the template processor class.

I have a 1x3 table in a template doc file. In one of the columns I have a block of text that I wish to clone or delete using cloneBlock or deleteBlock function. I notice that without styling cloneBlock and deleteBlock functions work as expected, but if I changed the font color of the block of text to white the generated doc file cannot be read on my computer with the following error message:

The Open XML file BasicTable(40).docx cannot be opened because there are problems with the contents or the file name might contain invalid characters(for example, V)...No error detail available.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

nicoder added a commit to nicoder/PHPWord that referenced this issue Feb 2, 2018
it wrongly matched `<w:pPr` when looking for `<w:p`

in that case the cloned block would not be valid XML,
and so the generated docx document could not be opened by Word

adding the `\b` word boundary to the regex fixes this.

the accompanying unit test failed with this message when trying to load
the generated file:

```
ErrorException: DOMDocument::loadXML(): Opening and ending tag mismatch:
p line 2 and body in Entity, line: 2
```

This might solve issues such as PHPOffice#681 and PHPOffice#664.
nicoder added a commit to nicoder/PHPWord that referenced this issue Feb 2, 2018
it wrongly matched `<w:pPr` when looking for `<w:p`

in that case the cloned block would not be valid XML,
and so the generated docx document could not be opened by Word

adding the `\b` word boundary to the regex fixes this.

the accompanying unit test failed with this message when trying to load
the generated file:

```
ErrorException: DOMDocument::loadXML(): Opening and ending tag mismatch:
p line 2 and body in Entity, line: 2
```

This might solve issues such as PHPOffice#681 and PHPOffice#664.
nicoder added a commit to nicoder/PHPWord that referenced this issue Feb 2, 2018
it wrongly matched `<w:pPr` when looking for `<w:p`

in that case the cloned block would not be valid XML,
and so the generated docx document could not be opened by Word

adding the `\b` word boundary to the regex fixes this.

the accompanying unit test failed with this message when trying to load
the generated file:

```
ErrorException: DOMDocument::loadXML(): Opening and ending tag mismatch:
p line 2 and body in Entity, line: 2
```

This might solve issues such as PHPOffice#681 and PHPOffice#664.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant