In fact, in order to get OpenOffice or LibreOffice through Python, you need to go through an absolutely opaque amount of boiler plate inherited from StarOffice - it has never been properly documented (felt) or simplified since then.
I once lectured on this and I took almot 40 minutes just to get parts of my lecture to set up the example below.
On the other hand, it just worked with the latest version of LibreOffice - 3.3 - I'm sure it works for OpenOffice too (but I would not advise anyone to stick with OpenOffice, at the moment this is an Oracle deadlock)
The following example uses the slow method to connect to an executable instance of LibreOffice from the outside. This is very slow - you will need to refer to the documentation on how to make it work as a macro from within the program to improve performance. (it really is so slow).
However, this method allows you to learn the methods available to developers using the Python terminal and introspection.
The first poorly documented part is that you need to run Open / LibreOffice with: soffice "-accept=socket,host=0,port=2002;urp;" For compounds to be accepted. Then create a new table through your interface and with the python interpreter that comes with Office Suite, execute the following code (either interactively or as a script):
import uno import socket
As you can see, the connecting part of this template I got somewhere else a few years ago, and I doubt that any living person can find any justification in such things. However, when you go to the "sheets" object, the attributes and methods of the object begin to make sense.
The online guide provides a complete guide for developers to even understand part of the connection:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/OpenOffice.org_Developers_Guide
jsbueno
source share