# LibreOffice 6.0 unzip - zip open document file?

In LibreOffice 5.0 I used to be able to open an Open Document file (e.g. *.ods or *.odb) on a low level by unzipping it. Then I could change something there on the "low level", zip it again and use it. I used the Ubuntu archive manager to do that.

Since Ubuntu 18.4 and LibreOffice 6.0 this does not work any more. The archive manager does not open it ("archive type is not supported"). However, if I open it with the utility "unzip" into a folder (that still works!) and, without changing anything, zip it again (put it into a zip-archive "Filename.zip" and change the extension from ".zip" to e.g., ".odb"), then LibreOffice cannot open it; it considers the file corrupt.

a) Did the file format change?

b) What can I do if I need to make low level changes to an Open Document file?

Xenon1

edit retag close merge delete

Sort by » oldest newest most voted

Likely that version of archive manager has some broken means what could be a zip file.. the file format did not change, it still is a zip container, otherwise the unzip utility would refuse to run on it.

When (re)zipping an ODF document you must ensure that the mimetype file is the very first file in the archive and not compressed, it must be plain text. If that is not the case (compressed file or different position in the zip directory) then it is not a valid ODF file.

To achieve that, easiest is to freshen the existing zip with the modified file(s) instead of creating a new zip, i.e. use the -f option, for example zip -f /path/to/filename.ods content.xml

When creating a new zip, add and store only the mimetype file first using the -0 (numeric zero, not letter O) option. Then add other files using the -u option.

more

Fwiw, I just tried with file-roller 3.22.3 (which is Archive Manager) and indeed already that doesn't accept for example an .ods document, and also not one that is 10 years old.

( 2019-03-07 00:54:56 +0200 )edit

"When (re)zipping an ODF document you must ensure that the mimetype file is the very first file in the archive and not compressed, it must be plain text." How do I do that? - And thank you for your fast answer, erAck!

( 2019-03-07 09:12:48 +0200 )edit

Maybe saving those, with the flat format can make easy edit the files (only fodt, fods, fodp).

( 2019-03-08 04:16:38 +0200 )edit

I updated my answer with "how to do that".

( 2019-03-08 12:40:49 +0200 )edit

Just found the solution: Rename file: a) replace *.ods with *.zip. Or, even easier: b) add .zip to file name.

Now the archive program opens it easily! It seems that the Linux-program archive does not want to open files with the "wrong" file extension.

more