I'm using unoconv to convert XLSX => PDF. I need LibreOffice to wrap text and increase row heights dynamically depending on the contents of the XLSX file. Is there a way to do this programmatically, maybe at the unoconv/soffice level?
The only way that worked for us was by patching unoconv so that it immediately performs the following actions after opening a document:
From python, it looks like this:
frame = document.CurrentController.Frame
dispatcher = self.unosvcmgr.createInstanceWithContext("com.sun.star.frame.DispatchHelper", self.context)
dispatcher.executeDispatch(frame, ".uno:SelectAll", "", 0, ())
dispatcher.executeDispatch(frame, ".uno:SetOptimalRowHeight", "", 0, UnoProps(aExtraHeight=0))
The patch file is here: https://gist.github.com/ldiqual/065aada05cfb50443bc67fc3ae99ea14
And this is how it is applied in Docker:
ENV UNO_URL https://raw.githubusercontent.com/unoconv/unoconv/master/unoconv
COPY ./unoconv.patch /tmp/unoconv.patch
RUN curl -Ls ${UNO_URL} -o /usr/local/bin/unoconv \
&& patch /usr/local/bin/unoconv /tmp/unoconv.patch \
&& chmod +x /usr/local/bin/unoconv \
&& rm /tmp/unoconv.patch \
I tryed to solve this problem here https://github.com/PasaOpasen/_excel_correct_cells
I think results are well, but it's not so easy
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.