ODFPy documentation

Luca picture Luca · Jun 4, 2009 · Viewed 15.7k times · Source

I need to manipulate the ODF file format (open document format, the open office's internal format), and I need to do it in Python.

It seem's ODFPy is a wonderful library for this purpose. Unfortunately the official documentation is very poor, almost unuseful. I can't find almost anything online - maybe it is not so popular?

Is there anyone who can point me at some some information or better documentation?

Answer

Nick Bastin picture Nick Bastin · Feb 2, 2010

The documentation is unfortunately horrible, and the generated Python wrapper is lousily documented in code, providing lots of functions whose argument lists look like func(*args).

The reference manual is actually useful, but not when you're starting out - it doesn't provide any context of how to use these functions. I would suggest starting with the tutorial and all the examples. Even though they may have nothing to do with your use case, they will help you get the feel of how the package works. After you've gotten used to the way the package is structured, you can often make sense of the documentation by combining the API doc with the information in the OpenDocument Essentials book.

(The relationship is somewhat tenuous at best, but you can often intuit method and attribute values from it. When working with the spreadsheet, for example, the handy list of office:value-type data in the book provided the necessary constants for building proper TableCell(valuetype=...) instances)

Also, making small documents in OpenOffice and then inspecting the xml and comparing it to the XML generated from ODFPy greatly helps you debug where you might have gone wrong.