3

At the moment I have a large collection of .odt files and I want to batch convert them to .docx files. I am working on a windows 10 computer. There are several options recommended on the web, almost all from the period 2008-2010 and none seem to work.

Rest of the post is options I tried:

One option is using the commandline and libreoffice. Something like this should work:

soffice --headless --convert-to docx:"MS Word 2007 XML" test.docx

Or this:

start /wait "" "C:\Program Files (x86)\LibreOffice 5\program\soffice.exe" --headless --convert-to docx --outdir D:\sourcePath\testFile.odt

However both commands and several variations I tried did nothing. No error, no new files, just nothing.

Another recommended option is BatchConv, in conjunction with open office. This also did nothing. I opened the file, accepted the macro's on start up, clicked the button, selected the files in the wizard, open office flickered for a while and in the end no files were converted and no error was shown.

Lastly a recommended option was mso2ooo, however this doesn't support docx (only doc).

phuclv
  • 30,396
  • 15
  • 136
  • 260
dimpol
  • 223

2 Answers2

1

This may not be the best

  • run scalc from Open Office.
  • File> Wizard > Document Converter
  • StarOffice - text documents > NEXT
  • disable templates unless used.
  • include subdirectories and select FROM , TO
  • CONVERT

then use MSOffice to convert DOC to Docx

1

The code in your example does not define a source file, so there's nothing to convert!

If that was a typo in this post only (and not relevant to your IRL case), the documentation also indicates to put the file extension inside the quotes with the filter argument, like so:

'C:\Program Files\LibreOffice\program\soffice.com' --convert-to "docx:Office Open XML Text" D:\sourcePath\file.odt --outdir D:\sourcePath

The soffice.com binary is provided specifically for command line operations and will generally perform better than the older method of calling soffice.exe --headless. See here for more information from the developer.

Also, to my knowledge, it is not possible to define an output file name different from the source file name.