First time here? Check out the FAQ!
I want to convert files from a script using command line options, for example:
libreoffice --headless --invisible --convert-to csv file.xls
This works only if Libre Office is not currently running interactively.
For example, if localc was run (on an unrelated document), then the above shell command silently fails to have any effect.
I suspect the command connects to the pre-existing interactive instance. How can I prevent this, forcing the command to use an independently started instance?
(or any other way to make the command work reliably, whether or not LO is already running)
This is unfortunately not directly possible thanks to Bug #37531.
The workaround is to run LibO with another profile. From that bug report then, comment 25 suggests using the not-so-well documented -env flag:
libreoffice "-env:UserInstallation=file:///tmp/LibO_Conversion" --headless --invisible --convert-to csv file.xls
If security is a concern, note that LibO creates that directory with user-only permissions, and you can similarly tack on an rm (or the appropriate operating system variant) command:
libreoffice [...] ; rm -rf /tmp/LibO_Conversion
LibreOffice is made available by volunteers around the globe, backed by a charitable Foundation. Please support our efforts: Your donation helps us to deliver a better product!
Asked: 2012-04-04 02:51:01 +0200
Seen: 739 times
Last updated: Jul 14 '12
Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.