How does Open Office compress its files?

前端 未结 4 1235
一向
一向 2020-12-29 10:45

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 fil

4条回答
  •  無奈伤痛
    2020-12-29 11:31

    Section 17 Of the OASIS OpenOffice Specification defines how OpenDocument Packages need to be packaged.

    Section 17.4 MIME Type Stream reads like this:

    If a MIME type for a document that makes use of packages is existing, then the package SHOULD contain a stream called "mimetype". This stream SHOULD be first stream of the package's zip file, it MUST NOT be compressed, and it MUST NOT use an 'extra field' in its header (see [ZIP])..

    The purpose is to allow packaged files to be identified through 'magic number' mechanisms, such as Unix's file/magic utility. If a ZIP file contains a stream at the beginning of the file that is uncompressed, and has no extra data in the header, then the stream name and the stream content can be found at fixed positions. More specifically, one will find:

    • a string 'PK' at position 0 of all zip files
    • a string 'mimetype' at position 30 of all such package files
    • the mimetype itself at position 38 of such a package.

提交回复
热议问题