OOoPy is a Python library for modifying OpenOffice.org documents. It provides a set of transformations on the OOo XML format using the ElementTree XML Library.
Transformations included are a mail merge application and the concatenation of documents with formatting intact. The framework supports easy creation of new transformations.
OpenOffice.org (OOo) documents are ZIP archives containing several XML files. Therefore it is easy to inspect, create, or modify OOo documents. OOoPy is a library in Python for these tasks with OOo documents.
To not reinvent the wheel, OOoPy uses an existing XML library, ElementTree by Fredrik Lundh. OOoPy is a thin wrapper around ElementTree using Python's ZipFile to read and write OOo documents.
In addition to being a wrapper for ElementTree, OOoPy contains a framework for applying XML transforms to OOo documents. Several Transforms for OOo documents exist, e.g., for changing OOo fields (OOo Insert-Fields menu) or using OOo fields for a mail merge application. Some other transformations for modifying OOo settings and meta information are also given as examples.
Applications like this come in handy in applications where calling native OOo is not an option, e.g., in server-side Web applications.
Don't be alarmed by the Alpha-Status of the Software: Reading and writing of OOo documents is stable as well as most transforms.
The only problematic transform is mailmerge: The OOo format is well documented but there are ordering constraints in the body of an OOo document. I've not yet figured out all the tags and their order in the OOo body. Another known shortcoming of OOoPys mailmerge is the renumbering of body parts of an OOo document.
Individual parts (like e.g., frames, sections, tables) need to have their own unique names. After a mailmerge, there are duplicate names for some items. So far I'm renumbering only frames, sections, and tables. See the renumber objects at the end of ooopy/Transforms.py.
What's New in This Release: [ read full changelog ]
· Add --newlines option to ooo_as_text: With this option the paragraphs in the office document are preserved in the text output. Fix assertion error with python2.7, thanks to Hans-Peter Jansen for the report. Several other small fixes for python2.7 vs. 2.6.
· add --newlines option to ooo_as_text
· fix assertion error with python2.7 reported by Hans-Peter Jansen
· fix several deprecation warnings with python2.7
· remove zip compression sizes from regression test: the compressor in python2.7 is better than the one in python2.6