[Sussex] Manipulating ODT files

Nic James Ferrier nferrier at tapsellferrier.co.uk
Mon Jul 23 11:58:00 UTC 2007


"Brendan Whelan" <b_whelan at mistral.co.uk> writes:

> I am trying to change the content of OpenOffice ODT files using PHP programs. 
> gunzip my_file.odt   gives a directory name my_files.odt_FILES containing various directories and files, including content.xml.
> I can change items within content.xml.
> My attempts at rezipping the files back to an odt don't give the correct structure.
> How do I rezip the directories and files to give a valid odt file?

As far as I know you just rezip it.

Here's a fragment of a Makefile that I use that creates my CV from a
very elabourate set of steps:


  cv.odt: cv/content.xml
          bash -c 'cd cv ; zip -r ../cv.odt *'


  cv/content.xml: html2oo.xslt cv.html cv
          xsltproc --html html2oo.xslt cv.html > cv/content.xml

  cv:
          [ -d cv ] || ( mkdir cv ; unzip -d cv cv.odt )

  cv.html: cv.xoxo cv-html.xslt
          xsltproc cv-html.xslt cv.xoxo > cv.html

So if I go:

   make cv.odt

it does,

Hope that helps!

-- 
Nic Ferrier
http://www.tapsellferrier.co.uk   




More information about the Sussex mailing list