ODF Applications > Ruby-based Conversion

Ruby-based ODT to XHTML Conversion

Download version of 18 Jan 2007

This is an alpha version of a program that converts the style.xml and content.xml of an OpenDocument text file to XHTML. It is intended to give you a reasonable idea of what the file looks like, not to do a completely accurate job of rendering the file. It is licensed under the GNU LGPL.


Using the Program

To convert the file testfile.odt to testfile.xhtml, you would enter this at the command line:

ruby odt_to_xhtml.rb --in testfile.odt --out testfile.xhtml

The program will build an internal stylesheet for the converted document. If you want the CSS to be in a separate file, add this option:

--css css_filename.css

The program will skip over any images in the OpenDocument file unless you add this option:

--images image_directory_name

The program then generates XHTML to display images, which are placed in the directory you specified. If the directory doesn’t exist, the program will create it.

If you omit the --out parameter, the results will go to standard output.


The program has been tested primarily on files generated by OpenOffice.org. It is alpha software, so it may not be able to properly interpret your document, especially if it was generated by some other OpenDocument-compatible application. Your mileage may vary.

If the program crashes, it will print out a stack trace. If you can email the file and the crash output to me at catcode@catcode.com, I will be able to track down errors more quickly. If the file is over 200K bytes, please just give me a link to a place where I can download it rather than attaching it to the email.

See list of changes