Ask Your Question
1

convert-to command line parameter

asked 2012-05-15 16:14:28 +0200

anonymous user

Anonymous

updated 2013-05-21 12:02:22 +0200

anonymous user

Anonymous

Hello, I'm trying to convert a Microsoft Word document to text using the convert-to command-line parameter using LibreOffice 3.4.5, OOO340m1 (Build:1505), on OpenSuse 12.1. I tried these two commands.

soffice --convert-to txt filename.doc Nothing happened.

soffice --headless --convert-to txt filename.doc Produced a PDF file.

Why do I need "--headless"? If this is mandatory, the documentation should state this. Can LibreOffice convert Word Perfect documents?

The format for "convert-to" parameter is: --convert-to output_file_extension[:output_filter_name] [--outdir output_dir]

What are the valid "output_file_extension" values? What are the valid "output_filter_name" values?

For the documentation, the "soffice --help" showed the "--convert-to" parameter. The help->LibreOffice Help does not show this parameter.

Thank you

delete close flag offensive retag edit

4 Answers

Sort by » oldest newest most voted
3

answered 2012-09-25 02:43:18 +0200

jopenid gravatar image jopenid
46 3 3

updated 2012-09-25 09:37:03 +0200

Here are a few more pointers for anybody else struggling with this.

This is the general format of convert-to (noting that on windows the parameter is -convert-to not --convert-to):

soffice --headless --convert-to <TargetFileExtension>:<NameOfFilter> file_to_convert.xxx

Use the link above (http://cgit.freedesktop.org/libreoffice/core/tree/filter/source/config/fragments/filters) to look for the filter names in the .xcu files.

For example, I wanted to convert to Excel 95 format so I found the MS_Excel_95.xcu filter and inside it has a name:

<node oor:name="MS Excel 95" oor:op="replace">
    ...

I could then try it out:

soffice --headless --convert-to xls:"MS Excel 95" filename.xlsx

(I needed this to get a non-xml version of an excel file)

link delete flag offensive edit
1

answered 2012-05-15 16:30:15 +0200

vmiklos gravatar image vmiklos
391 4 10

Probably --convert-to should imply --headless, but if you want this, please open a bugreport.

Regarding the filters available, you can poke around at http://cgit.freedesktop.org/libreoffice/core/tree/filter/source/config/fragments/filters (sure, a more user-friendly wiki page would be better), for example if you want to convert to odt, try '--convert-to odt:writer8'.

link delete flag offensive edit
0

answered 2012-05-16 01:48:00 +0200

w_whalley gravatar image w_whalley flag of United States
1581 10 24

This syntax worked for LO 3.4.6

soffice --headless --convert-to txt:text file_to_convert.doc

But only if no other instances of LO are open.

link delete flag offensive edit
0

answered 2012-12-13 21:19:12 +0200

cben gravatar image cben
1 1

updated 2012-12-13 21:49:36 +0200

--headless is not strictly mandatory, but you want it.
Without it, the document is still converted (note "convert /.../filename.doc -> /.../filename.txt using text" message on stdout) but an empty GUI is also started (and the command blocks until you close the GUI).

More importantly, headless conversion silently does nothing if any LO is already open; see http://ask.libreoffice.org/en/question/1686 for a solution.

link delete flag offensive edit

Login/Signup to Answer

Donate

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!

Question tools

Follow

subscribe to rss feed

Stats

Asked: 2012-05-15 16:14:28 +0200

Seen: 7,600 times

Last updated: Dec 13 '12