Johann Vette
Johann Vette

Reputation: 1

Linux & OpenDocument Format - How to compress directory of XML files to ODF in the command line?

I am trying to experiment with ODF files, specifically .ods files. The directory I am working with is an unzipped .ods file made with LibreOffice, and all I am trying to do is recompress it.

I have tried using the following commands:

I was expecting to open test_new.ods with LibreOffice and it display the cells that I have added. Instead I either get an error saying the file is corrupted or it displaying each XML document's content instead of the data I added to the cells.


UPDATE: I read this answer but the problem is the same error of corruption by LibreOffice is still happening

Upvotes: 0

Views: 64

Answers (2)

Jerome Dumonteil
Jerome Dumonteil

Reputation: 16

If you can use Python packages, the odfdo library contains a script named odfdo-folder that can create an ODF package from the content of the unzipped content.

usage: odfdo-folder [-h] [--version] file_or_folder

Convert standard ODF file to folder, and reverse.

Upvotes: 0

Mark Adler
Mark Adler

Reputation: 112159

You need to be zipping from inside the directory, not outside of it, where the latter would put test1/ before every file name. You also need to zip mimetype first, with no compression, using -0, and then zip the remaining files, excluding mimetype.

tar and gzip have nothing to with this. You do not need to use -Z.

cd test1
zip -X -0 ../test_new.ods mimetype
zip -X -r ../test_new.ods * -x mimetype
cd ..

Upvotes: 0

Related Questions