Convert-to command line parameter

One more addendum:
It is possible to read - for example here: http://www.computerhope.com/starthlp.htm, www.microsoft.com is silent about that - that “When executing an application that is a 32-bit GUI application, CMD.EXE does not wait for the application to terminate before returning to the command prompt. This new behavior does NOT occur if executing within a command script.”; so it should imply that when executing soffice.exe from a batch script,

[continued] it is not necessary to call it via start /wait command. Unfortunately, it is NOT true. At least on Windows Vista (I know, horrible OS - but it was not on my computer) it is necessary to use start /wait even in a batch, otherwise the conversion collapses. Update: Primary source for the incorrect information about the start command (Microsoft’s site). LO version: 4.3.6.

Been testing with 5.0 64bit and found the --outdir cannot be quotes. Example
good: --outdir c:\temp
bad: --outdir “c:\temp”

If you are still having problems I would recommend using the portable version of LO:
download page

Combining all the info given in this page, the following code allowed me to batch convert ppt files using LO in Windows 7:

for %f in (*.ppt) do (
    start /wait "" "C:\Program Files\LibreOffice 4\program\soffice.exe" --headless --convert-to pdf --outdir C:\tmp %f
)

(Got a lot of errors before I found that an empty quote was required if the path contain spaces)

For anyone trying to do this in powerscript, you can use link:this
workaround to get powershell to wait for the conversion process to finish:

My code looked like this:

soffice --headless --invisible --convert-to html:HTML $filename --outdir $outputDir | Out-Null

@w_whalley’s answser was close, but didn’t work for my version: LibreOffice 4.2.8.2

This worked:

soffice --headless --convert-to txt:"Text" file_to_convert.odt 

(I happened to do it with an odt. haven’t tried .doc yet).

(thanks to: @quibit here: How do I install filters for the `soffice` command?)

I’m using LibreOffice Version: 4.3.7.2, running on Ubuntu 14.10. Using the above and other questions and answers I’ve gotten the following command to work. The headless option is discussed above. The env parameter allows the command to run even if libreoffice is already running.

soffice -env:UserInstallation=file:///tmp/tempprofile --headless --convert-to csv FileName

I do have an additional problem. The spreadsheets I’m converting to csv have a libreoffice basic function. When I use the GUI to convert to csv, the values as displayed go into the csv file. When I use the command line, all I get is #VALUE!.

Is there a way to get the correct, calculated value, into the csv file?

Thanks for any answers!!

Hallo,

I tried multiple things with LibreOffice 4.2.8.2-11.el6_7 (my company’s default version).

This one worked for me to convert calc file in .ods format to HTML:

 libreoffice --headless -env:UserInstallation=file://${tmp} --convert-to html ${myfile}

--outdir was not required in my experiments, but it works if you use it.

The --convert-to command does not work for password-protected files, and there seems to be no option to pass a password. It simply fails silently with no hint to the user what went wrong.
There are some other interesting commandline options, depending on your local env and requirements.

--norestore    suppress restart/restore after fatal errors.
--quickstart   starts the quickstart service
--nologo       don't show startup screen.
--nolockcheck  don't check for remote instances using the installation

It did not work for me to explicitly write the filter as html:HTML.
This resulted in the error message

Error: Please reverify input parameters...

Thank you, that simpler command

soffice --headless --convert-to html --outdir ./ input.odt

also worked for me.

But these did too:

… html:HTML …

… htm:HTML …

… htm …

and all gave during conversion:

convert /home/user/Desktop/input.odt → /home/user/Desktop//input.htm using HTML (StarWriter)

Only “htm:HTM” failed, with

convert … using HTM

Error: Please reverify input parameters…