> Is it possible to construct a zip file from the extracted contents of > an ods or odt file that is identical to the original ods/odt file? I > would like to be able to do something like the following: > > $ unzip doc.odt -d doc > $ cd doc > $ zip [options] ../doc2.zip * > $ diff ../doc.odt ../doc2.zip && echo match > match > > I tried the following with [options] being -9Xr, but the resulting zip > file was 7163 bytes and the original odt was 6741 bytes. > > I've attempted to determine the sequence of operations that OOo uses > to create its zip files by analyzing the source code, but I haven't > figured out exactly how it does it. There seems to be some > compression going on in AddXMLAsZipToTheStorage in > binfilter/bf_sfx2/source/doc/sfx2_objstor.cxx, which uses the ZCodec > class implemented in tools/source/zcodec/zcodec.cxx (which in turn > uses zlib), but I'm not sure if this is the code that handles all the > zip file stuff and I don't know where it gets the list of files to > compress. > > Does someone know of a set of zlib operations that will produce a zip > file identical to the one OOo produces? Or is there a set of options > I can pass to a common zip command-line tool that will do this? > > This has been discussed to some extent before > (http://www.openoffice.org/servlets/BrowseList?list=dev&by=thread&from=1243563), > but it was specifically in relation to storing OOo files in > Subversion, which is in the end what I'm interested in. It would be > nice to commit OOo files to Subversion, have it store the XML files > individually, and then get it to reproduce an identical OOo file from > the XML files when a user checks it out.
If you insist that the generated zip file is the same, then you likely need to use their API to create it. In general, it should not matter if the generated file is identitical, just that it is valid. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
