soffice --headless -convert-to odt:"writer8" somefile.docx

Commandline document conversion with Libreoffice

In this example, the docx gets converted to Open Document .odt format. For other formats, you'll need to specify the correct filter (Hint: see "Comments" link below for a nice list).

14
By: mhs
2012-12-27 15:08:38

These Might Interest You

What Others Think

### TextDocument bib:"BibTeX_Writer" doc:"MS Word 97" doc:"MS WinWord 6.0" doc:"MS Word 95" xml:"DocBook File" docx:"Office Open XML Text" docx:"MS Word 2007 XML" fodt:"OpenDocument Text Flat XML" html:"HTML (StarWriter)" ltx:"LaTeX_Writer" txt:"MediaWiki" odt:"writer8" xml:"MS Word 2003 XML" ott:"writer8_template" pdb:"AportisDoc Palm DB" pdf:"writer_pdf_Export" psw:"PocketWord File" rtf:"Rich Text Format" sdw:"StarWriter 5.0" sdw:"StarWriter 4.0" sdw:"StarWriter 3.0" stw:"writer_StarOffice_XML_Writer_Template" sxw:"StarOffice XML (Writer)" txt:"Text (encoded)" txt:"Text" uot:"UOF text" vor:"StarWriter 5.0 Vorlage/Template" vor:"StarWriter 4.0 Vorlage/Template" vor:"StarWriter 3.0 Vorlage/Template" html:"XHTML Writer File" ### WebDocument txt:"Text (encoded) (StarWriter/Web)" html:"writer_web_StarOffice_XML_Writer_Web_Template" html:"HTML" html:"writerweb8_writer_template" txt:"MediaWiki_Web" pdf:"writer_web_pdf_Export" sdw:"StarWriter 3.0 (StarWriter/Web)" sdw:"StarWriter 4.0 (StarWriter/Web)" sdw:"StarWriter 5.0 (StarWriter/Web)" txt:"writerweb8_writer" txt:"writer_web_StarOffice_XML_Writer" txt:"Text (StarWriter/Web)" vor:"StarWriter/Web 4.0 Vorlage/Template" vor:"StarWriter/Web 5.0 Vorlage/Template" ### Spreadsheet csv:"Text - txt - csv (StarCalc)" dbf:"dBase" dif:"DIF" fods:"OpenDocument Spreadsheet Flat XML" html:"HTML (StarCalc)" ods:"calc8" xml:"MS Excel 2003 XML" ots:"calc8_template" pdf:"calc_pdf_Export" pxl:"Pocket Excel" sdc:"StarCalc 5.0" sdc:"StarCalc 4.0" sdc:"StarCalc 3.0" slk:"SYLK" stc:"calc_StarOffice_XML_Calc_Template" sxc:"StarOffice XML (Calc)" uos:"UOF spreadsheet" vor:"StarCalc 3.0 Vorlage/Template" vor:"StarCalc 4.0 Vorlage/Template" vor:"StarCalc 5.0 Vorlage/Template" xhtml:"XHTML Calc File" xls:"MS Excel 97" xls:"MS Excel 5.0/95" xls:"MS Excel 95" xlt:"MS Excel 97 Vorlage/Template" xlt:"MS Excel 5.0/95 Vorlage/Template" xlt:"MS Excel 95 Vorlage/Template" ### Graphics bmp:"draw_bmp_Export" emf:"draw_emf_Export" eps:"draw_eps_Export" fodg:"OpenDocument Drawing Flat XML" gif:"draw_gif_Export" html:"draw_html_Export" jpg:"draw_jpg_Export" met:"draw_met_Export" odd:"draw8" otg:"draw8_template" pbm:"draw_pbm_Export" pct:"draw_pct_Export" pdf:"draw_pdf_Export" pgm:"draw_pgm_Export" png:"draw_png_Export" ppm:"draw_ppm_Export" ras:"draw_ras_Export" std:"draw_StarOffice_XML_Draw_Template" svg:"draw_svg_Export" svm:"draw_svm_Export" swf:"draw_flash_Export" sxd:"StarOffice XML (Draw)" sxd:"StarDraw 3.0" sxd:"StarDraw 5.0" sxw:"StarOffice XML (Draw)" tiff:"draw_tif_Export" vor:"StarDraw 5.0 Vorlage" vor:"StarDraw 3.0 Vorlage" wmf:"draw_wmf_Export" xhtml:"XHTML Draw File" xpm:"draw_xpm_Export" ### Presentation bmp:"impress_bmp_Export" emf:"impress_emf_Export" eps:"impress_eps_Export" fodp:"OpenDocument Presentation Flat XML" gif:"impress_gif_Export" html:"impress_html_Export" jpg:"impress_jpg_Export" met:"impress_met_Export" odg:"impress8_draw" odp:"impress8" otp:"impress8_template" pbm:"impress_pbm_Export" pct:"impress_pct_Export" pdf:"impress_pdf_Export" pgm:"impress_pgm_Export" png:"impress_png_Export" potm:"Impress MS PowerPoint 2007 XML Template" pot:"MS PowerPoint 97 Vorlage" ppm:"impress_ppm_Export" pptx:"Impress MS PowerPoint 2007 XML" pps:"MS PowerPoint 97 Autoplay" ppt:"MS PowerPoint 97" pwp:"placeware_Export" ras:"impress_ras_Export" sda:"StarDraw 5.0 (StarImpress)" sdd:"StarImpress 5.0" sdd:"StarDraw 3.0 (StarImpress)" sdd:"StarImpress 4.0" sxd:"impress_StarOffice_XML_Draw" sti:"impress_StarOffice_XML_Impress_Template" svg:"impress_svg_Export" svm:"impress_svm_Export" swf:"impress_flash_Export" sxi:"StarOffice XML (Impress)" tiff:"impress_tif_Export" uop:"UOF presentation" vor:"StarImpress 5.0 Vorlage" vor:"StarDraw 3.0 Vorlage (StarImpress)" vor:"StarImpress 4.0 Vorlage" vor:"StarDraw 5.0 Vorlage (StarImpress)" wmf:"impress_wmf_Export" xml:"XHTML Impress File" xpm:"impress_xpm_Export"
mhs · 281 weeks and 3 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: