views:

452

answers:

4

I would like to convert doc/docx documents to semantic HTML.

Some wishes/requirements:

  1. Semantic HTML such that headers in the document are <h1>, <h2> etc., tables are <table> and so forth.

  2. Should preferably be possible to handle headings, lists, tables and images. Graphs and math formulas is a nice extra.

• Doesn't have to be converted straight from doc/docx to html, could use an intermediary format, such as xml or docbook.

• Should work programatically, and with large number of documents.

The closest thing to a solution I've found so far is http://holloway.co.nz/docvert/index.html, but unfortunately there are many a few bugs, small user base and it can't handle a lot of documents. More of a proof of concept.

+1  A: 

There's a tool called upCast which is able to convert Word documents into XML.

Jukka Matilainen
upCast is in the right direction, although not exactly what I am looking for. I am still searching, so further tips are appreciated.However, I want to award the “answer” to someone and chose this.
sandstrom
A: 

I've written code for the requirements you listed, not including images and graphs and maths formulas. It's alpha quality, i.e. "it works on my machine". You can email me if you're interested: my gmail user id is "cwellsx".

ChrisW
A: 

" headers in the document are " I think this is impossible. Because MS Word only write down the result, with different styles of <p> just like printed text on paper, the original info are not recorded.

Your other wishes could be approached. There're two commercial tools can do this (don't believe those free tools or online tools, they don't do the real work.)

1 Word Cleaner by Zapadoo www.zapadoo.com
2 HTML Cleaner for Word by wonder Studio www.htmlcleaner.com

I prefer the second one which released just last year. You can try them both.

Soft Rover
A: 

docx4j (for docx only, not doc) writes clean HTML output. You'd need to change things a bit if you wanted <h1> instead of <p class="h1">, but its open source so you can do that.

plutext