I've had success unzipping and examining the interior of a .docx file, but I can't seem to get the re-zipping to work properly. I've tried no compression (command line: zip -0r ...), the archive utility, and a 7zip plugin but none of that works. All of the .docx files I create won't open in the original programs, even when I don't change a single file. Any tips?
It is important that the files that make up the
docx are not within another folder, i.e.
[Content_Types].xml must be in the root of the resulting zipped file. A similar question has been asked on StackOverflow.
When you open (or extract to the current directory) the
zip file, you should have something similar to the following:
./docProps/ ./word/ ./_rels/ ./customXml/ ./[Content_Types].xml
If you have those files within another directory inside the
docx file, it won't work. Note that I don't get the
customXml folder on an empty Word document, but the report I originally tested with did have it. You may have some more (or less) directories.
The command to rezip these, issued from the "current directory", is:
zip -r preso.pptx *