Open bburdette opened 1 year ago
I'm experiencing an identical issue. Looking forward to your help.
Describe the Bug:
The error IS due to an unescaped XML Element.
It is most likely to be caused by the Header & Footer style.
The '&' is not escaped and seeps into the XMLDoc, when a source document is read using the read_docx function .
A snapshot from the styles.xml, this was produced by the writer, is here to illustrate the val with an unescaped & character.
Describe the bug
I was going to make a search-and-replace utility, but it looks like the template document doesn't survive reading and writing.
Reproduced step
Here's how far I got. Read in the document, write it again. I had a search and replace step (untested) but that's commented out.
https://github.com/bburdette/docx-template/blob/f2205657daa70795ffe9a177653fadf37df4f77a/src/main.rs#L38
Expected behavior
Expected the same document to be written as as was read in.
Actual behavior
Only the first line is found in the output document.
Screenshots
Input:
An error occurs on opening the output file:
Proceeding anyway, only the first line survives:
Desktop (please complete the following information)
docx-rs = { git = "https://github.com/bokuweb/docx-rs.git", rev="bffbd468e3af9739792bcf2b35eb373aadba4785" }