Ask Your Question

How to convert document from cmdline on windows

asked 2018-10-31 19:08:11 +0100

lazna gravatar image

Nothing happens on this command. No file produced, no error message, errorlevel 0. What am I doing wrong?


"C:\Program Files\LibreOffice\program\soffice.bin" --outdir "C:\Users\USER\Desktop__TEMP__" --convert -to "html:XHTML Writer File:UTF8" "C:\Users\USER\Desktop__TEMP__\document.doc"


edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2018-10-31 20:23:49 +0100

Mike Kaganski gravatar image

updated 2018-10-31 20:24:06 +0100

Error 1: --outdir is only valid after --convert-to.

Error 2: --convert-to does not have a space between --convert and -to.

So the proper command line would be

"C:\Program Files\LibreOffice\program\soffice.bin" --convert-to "html:XHTML Writer File:UTF8" --outdir "C:\Users\USER\Desktop__TEMP__" "C:\Users\USER\Desktop__TEMP__\document.doc"

A problem here is that on some Windows versions, the output from soffice isn't sent to console (cmd). That is a known bug.

edit flag offensive delete link more


Thanks for reply. There is not space in '--convert-to', probably linewrap in forum. Command you post do nothing too. All filepath verified twice. You wrote SOME windows version does not output to console (STDOUT and/or STDER), do you known what version DO the output?

lazna gravatar imagelazna ( 2018-10-31 20:36:34 +0100 )edit

Just install LibreOffice 5.4.3 and exact same behaviour :-/

lazna gravatar imagelazna ( 2018-10-31 20:55:23 +0100 )edit

do you known what version DO the output?

Yes: Win10 with activated new-style cmd (the one where I test).

Command you post do nothing too

Nothing to say, except: I have created the directories, and tested it to work locally before posting. To have the output on any Windows, you might use cygwin.

Mike Kaganski gravatar imageMike Kaganski ( 2018-10-31 21:09:01 +0100 )edit

Aha, I misunderstood sentence "some windows versions". I understand it "some windows versions of libreoffice (oposit to linux versions)" and not "libreoffice under some windows versions". Will test it under W10.

lazna gravatar imagelazna ( 2018-10-31 21:52:18 +0100 )edit

Same problem on Windows 10/64bit. Only difference compare to Windows 7 is, that "soffice.bin --help" output help screen there. Trying to google for details, bug report or anything else, but have no luck. Could you point me where people know more? I need single windows LO version which do console operations successfully. Or how to use cygwin in such case.

lazna gravatar imagelazna ( 2018-11-01 10:02:07 +0100 )edit

well, no idea where people could know more than a person who created the code (yours truly).

Only difference compare to Windows 7 is, that "soffice.bin --help" output help screen there

That was the idea (I mentioned that some versions don't output error messages to console; you now see them, and I suppose that using the initial command would output useful messages wrt wrong argument order).

Now the question is if you get a correct HTML doing that interactively.

Mike Kaganski gravatar imageMike Kaganski ( 2018-11-01 10:24:20 +0100 )edit

Interactive conversion working OK. You says it DOES working for you on windows 10, could you tell me EXACT version (both windows and LO) of your working combination?

lazna gravatar imagelazna ( 2018-11-01 10:42:00 +0100 )edit

Windows 10 Version 1809 (Build 17763.55)

LO Version: (x64) Build ID: 86daf60bf00efa86ad547e59e09d6bb77c699acb CPU threads: 12; OS: Windows 10.0; UI render: GL; Locale: ru-RU (ru_RU); Calc: CL

But actually it doesn't matter, since it also works on the same system with, e.g., Version: Build ID: a22f674fd25a3b6f45bdebf25400ed2adff0ff99 Locale: ru_RU

or with same LO version on Win7 VM

The question is either in your data (a sample would be useful), or LO configuration

Mike Kaganski gravatar imageMike Kaganski ( 2018-11-01 10:51:58 +0100 )edit

LO configuration is default (just installed), original document is here

lazna gravatar imagelazna ( 2018-11-01 10:59:20 +0100 )edit

Despite you've written

All filepath verified twice

I'll still ask: Are you positive that you have the directory named Desktop__TEMP__ under your user's profile directory, and not a __TEMP__ under Desktop?

EDIT: sorry for the noise (I removed the following incorrect comment): I really cannot reproduce with your data (it works on my system; my "reproducing" was because I used wrong paths left from my previous testing) - so: are you using correct paths?

Mike Kaganski gravatar imageMike Kaganski ( 2018-11-01 11:00:53 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-10-31 19:08:11 +0100

Seen: 33 times

Last updated: Nov 01