Using libreoffice libraries from python without UNO.

Michael Stahl mstahl at redhat.com
Mon May 12 04:38:28 PDT 2014


On 09/05/14 22:27, Jonny wrote:
> Hi,
> 
> I am using some tools to generate odf-documents. In order to convert
> them to pdf I'm using writer, but I need to run the function
> tools->update->all for updating TOC.
> 
> I thought that I would write a python script for doing this but I would
> like to call the libraries directly and not via UNO. My script would
> look something like:
> 
> import libreoffice
> 
> document = libreoffice.Writer('path/to/my/document.odt')
> document.update('all')
> document.save()
> document.close()
> 
> What I need is some guidance to in which libraries the functionallity
> for open, update and save are located. I have been digging around in the
> code without success. If someone has an idea it would save me a lot of time.

the problem is that that's all implemented in C++, but worry not, you
can just use UNO to call the C++ code :)

to do this first get the indexes from the document and then use the
update method, as described here:

https://wiki.openoffice.org/wiki/Documentation/DevGuide/Text/Indexes_and_Index_Marks


More information about the LibreOffice mailing list