Create openoffice .odt document with Python

后端 未结 3 571
天涯浪人
天涯浪人 2021-02-06 07:30

How can I create an open office .odt file from Python?

I\'m looking at this http://wiki.openoffice.org/wiki/Python, but am confused. I\'ve already got Python 2.7 so whe

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-06 07:56

    UNO Python bindings allows to run python scripts inside OpenOffice/LibreOffice, like Basic macroses.

    They allows to do almost everything that OpenOffice can do by itself, including creating ODT documents of course, but they required to be run in specific environment and depends on OpenOffice.

    Here is basic tutorial for Python-UNO in OpenOffice: http://www.openoffice.org/udk/python/python-bridge.html

    To edit ODT documents from Python I found this library: https://joinup.ec.europa.eu/software/odfpy/home but I never tried it actually.

    For my task (small modification of existing document) I ended with manual editing of XML files in .odt zip file using zipfile Python module and lxml library for parsing and editing XML.

提交回复
热议问题