Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a simple way to write an ODT using Python?

Tags:

python

odt

uno

My point is that using either pod (from appy framework, which is a pain to use for me) or the OpenOffice UNO bridge that seems soon to be deprecated, and that requires OOo.org to run while launching my script is not satisfactory at all.

Can anyone point me to a neat way to produce a simple yet clean ODT (tables are my priority) without having to code it myself all over again ?

edit: I'm giving a try to ODFpy that seems to do what I need, more on that later.

like image 702
MP0 Avatar asked Apr 01 '11 22:04

MP0


1 Answers

Your mileage with odfpy may vary. I didn't like it - I ended up using a template ODT, created in OpenOffice, oppening the contents.xml with ziplib and elementtree, and updating that. (In your case, it would create only the relevant table rows and table cell nodes), then recorded everything back.

It is actually straightforward, but for making ElementTree properly work with the XML namespaces. (it is badly documente) But it can be done. I don't have the example, sorry.

like image 141
jsbueno Avatar answered Nov 09 '22 13:11

jsbueno