This question is focused on Windows + LibreOffice + Python 3.
I've installed LibreOffice (6.3.4.2), also
pip install unoconv
and pip install unotools
(pip install uno
is another unrelated library), but still I get this error after import uno
:
ModuleNotFoundError: No module named 'uno'
More generally, and as an example of use of UNO, how to open a .docx document with LibreOffice UNO and export it to PDF?
I've searched extensively on this since a few days, but I haven't found a reproducible sample code working on Windows:
headless use of
soffice.exe
, see my question+answer Headless LibreOffice very slow to export to PDF on Windows (6 times slow than on Linux) and the notes on the answer: it "works" withsoffice.exe --headless ...
but something closer to a COM interaction (Component Object Model) would be useful for many applications, thus this question hereRelated forum post, and LibreOffice: Programming with Python Scripts, but the way uno should be installed on Windows, with Python, is not detailed; also Detailed tutorial regarding LibreOffice to Python macro writing, especially for Calc
I've also tried this (unsuccessfully): Getting python to import uno / pyuno:
import os os.environ["URE_BOOTSTRAP"] = r"vnd.sun.star.pathname:C:\Program Files\LibreOffice\program\fundamental.ini" os.environ["PATH"] += r";C:\Program Files\LibreOffice\program" import uno