Question

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.

Was it helpful?

Solution

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

OTHER TIPS

" 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.

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.

I wrote a utility which implements the requirements you listed, excluding images, graphs and maths formulas. It's beta quality (i.e., it works on my machine). I published it at http://www.modeltext.com/word

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top