AUTHOR: Piotr MaliƄski
Contact: riklaunim@gmail.com
Site: http://www.cms.rk.edu.pl - Polish
License: LGPL, template.xsl from http://books.evc-cit.info/odf_utils/odt_to_xhtml.html
Requirements: PHP5 (and PECL ZIP extension is recommended)

This class converts OpenDocument (ODT) filest to XHTML. OpenDocument are the default file format for OpenOffice Writer and Koffice KWord (supported also by AbiWord and other applications). Using this class you can convert ODT file to XHTML with pure PHP and operations on XML.
Differences between OpenOffice2HTML: this class supports only OpenDocument ODT files and uses XSLT transformation to get XHTML code (much better styles support).

  • $class = new ODT2XHTML;
    echo $class->oo_convert($class->oo_unzip('test.odt'));

    oo_unzip($file, $path = false) - $file is a patch to ODT file. This method will: 1. return a string - XML with the content, 2. save images (if any) to $path/Pictures ($path with trailing slash!). You need write permission on the target folder. It will throw an exception if ZIP functions aren't available or $file doesn't exist.

    oo_convert($xml) - returns XHTML code out of $xml string