I'm trying to create an Open Office spreadsheet programmatically but for some reason simply compressing a folder with all the necessary files makes Open Office flag the file as corrupted.
How did I get to this? I started by creating a normal spreadsheet in Open Office with some values in it. After saving I change the extension to .zip and make a copy of the folder. I then compress the second folder using command line zip and change the file extension to .ods. When trying to open the resulting file I get an error from Open Office saying the file is corrupt.
Does Open Office use a special compression algorithm? Doing a "file test.ods" shows it as a compressed zip, so what does Open Office add during the compression routine to make it work?
Documentation here. This steps worked for me:
Uncompress the original document file (it's a normal zip file) to some directory:
$ mkdir document
$ cd document
$ unzip ../document.odt
Modify the uncompressed data.
Create a new odt:
$ zip -0 -X ../document2.odt mimetype
$ zip -r ../document2.odt * -x mimetype