Sponsor for PC Pals Forum

Author Topic: How to correctly create ODF documents using zip  (Read 1003 times)

Offline sam

  • Administrator
  • *****
  • Posts: 19977
How to correctly create ODF documents using zip
« on: March 14, 2010, 20:38 »
http://www.jejik.com/articles/2010/03/how_to_correctly_create_odf_documents_using_zip/

Quote
One of the great advantages of the OpenDocument format is that it is simply a zip file. You can unzip it with any archiver and take a look at the contents, which is a set of XML documents and associated data. Many people are using this feature do create some nifty toolchains. Unzip, make some changes, zip it again and you have a new ODF document. Well… almost.

The OpenDocument Format specification, section 17.4 has one little extra restriction when it comes to zip containers: The file called “mimetype” must be at the beginning of the zip file, it must be uncompressed and it must be stored without any additional file attributes. Unfortunately many developers seem to forget this. It is the number one cause of failed documents at Officeshots.org. If the mimetype file is not correctly zipped then it is not possible to programmatically detect the mimetype of the ODF file. And if the mimetype check fails, Officeshots (and possibly other applications) will refuse the document. This problem is compounded because virtually no ODF validator checks the zip container. They only check the contents.

In this article I will show you how you can properly zip your ODF files, but before I do that I will show you the problem in detail.
- sam | @starrydude --


Show unread posts since last visit.
Sponsor for PC Pals Forum