8

I'm looking for free software that can convert OpenDocument to HTML or markdown.

Pandoc can convert HTML to OpenDocument, but not the reverse.

odt2html.py failed to install using both pip and easy_install.

LibreOffice can reportedly do the conversion; however, I couldn't get it to work with the following command:

soffice --convert-to --outdir . htm:HTML my.odt
evan.bovie
  • 3,342
the
  • 2,929

2 Answers2

8

You're using --convert-to, but you're not specifying the value for it.

The correct syntax is:

soffice --headless --convert-to htm:HTML --outdir . my.odt

Or try to use the following script:

#! /bin/bash

CONFIG=/path/to/tidy_options.conf
# rm -rv "$2"
mkdir -p "$2"

for F in `find $1 -type f -name "*.doc" -or -name "*.odt"`; do
  BASE=`basename $F .doc` ; BASE=`basename $BASE .odt`
  soffice --headless --convert-to htm:HTML --outdir $2 $F
  tidy -q -config $CONFIG -f $2/$BASE.err -i $2/$BASE.htm | sed 's/ class="c[0-9]*"//g' > $2/$BASE.html
done

Usage:

$ convert_doc_to_html.sh SOURCE_DIR TARGET_DIR

See:

kenorb
  • 26,615
5

New versions of pandoc, the open source universal document converter, work now:

pandoc -t html -s input.odt -s -o output.html 
Daniel-KM
  • 151