I will try to keep this short and simple.
I made a program that is able to modify text within the Docx document.xml file. I achieved this through xml parsing and it works great. Right now my program is outputting a new document.xml file that is exactly identical to the original one minus the altered text. My problem starts when I try to re-zip the docx files.
Just for testing purposes, I've been manually deleting the original document.xml file within the word folder and adding the new one. Eventually I want my program to do that but not at that point yet.
So whats happening, is after re-zipping all the contents, Microsoft Word says the file is corrupt. By the way if I don't alter the document.xml file, and re-zip it, it works fine. So I don't think there is anything wrong with the zipping.
But I if I delete the original document.xml file and then put it back, Microsoft word says its corrupt. Its really weird.
Here is my original document.xml file
https://www.dropbox.com/s/ghe1m176rdqtng7/document.xml?dl=0
and the updated one.
https://www.dropbox.com/s/8n9llagozbvb2mz/document_output.xml?dl=0
Hope someone can shed some light on whats going on.
Thanks!