Friday, March 25, 2011

The so called Hidden Features of LibreOffice 3.3

There are quite a few non-noticeable features in LibreOffice 3.3.x. I thought of sharing a few here...

Batch conversion
Especially useful when you want to work with command line or invoke conversion from another program or convert set of files to a given format (batch process).

Equivalent commands: oocalc (and its set), localc (and its set), soffice.bin
Assuming the current working directory is the libreoffice installation directory

The following command would convert all the *.doc files to *.pdf files
./soffice.bin -convert-to pdf:writer_pdf_Export -outdir /home/user/output /inputfiles/*.doc

[PS: wildcards wouldn't work correctly on windows specify the file names (list) instead.]

Forcing input filter while opening via command line
Whenever we open a file using the command line, we wouldn't generally have a choice to select the input file type (e.g. xlsx MSO 2007 or xlsx MSO 2010 or anyother). We would be at the mercy of the program to auto detect correctly. Use the following option to force opening the file with a given filter.
./soffice.bin -infilter="Calc Office Open XML" file.xlsx

Combining the above two
oh well...I guess by now it should be easy ;)

./soffice.bin -help
List of output filters:
List of input filters: Search with the above example filter or

Watch out for more such features...


jberryman said...

I was very excited to see those changes in the 'soffice' binary (wow, even a --help flag!). Thanks for the links to the allowed filter strings.

Are there any plans to add options to the conversion functionality? One thing I was able to do with the tools that used uno bindings like pyodconvert was to scale spreadsheets to a single page, and I'm missing that.

dezigns333 said...

I am trying to convert files through a php call but I am getting empty files as the output. But it works through the command line directly. Any ideas?

Muthu Subramanian K said...

@dezigns333: It should work...probably the directory is not writable by the php user?

@jberryman: Sure! Maybe when I get some time :) Making the options generic is tricky though. Do you know C++ by any chance? We could sure use your help!

רן רוטנברג said...

Thanks, I was looking for something like the batch conversion for a long time