Convert MSword to XML/HTML on Linux

2019-07-21 19:12发布

问题:

I need to convert MSWord file into XML or HTML, while preserving the structure of the file (mainly tables). I happened to find tika, which is quite powerful in extracting text from MSword files (and any files), as follows:

curl www.vit.org/downloads/doc/tariff.doc \ | java -jar tika-app-1.3.jar --text

and I can select from the options to save the output into html/XML, as follows:

curl www.vit.org/downloads/doc/tariff.doc \ | java -jar tika-app-1.3.jar --html

But the output is basically like a plain text written in HTML, so it is not possible to get the table structure and other document elements.

Is there any implementation of Tika, in Perl or Python, where it is possible to convert the document into XML/HTML while maintining the structure of its elements? Or is there any other tool on linux that can do this?

回答1:

Install OpenOffice SDK, it offers powerfull API for all kinds of documents (including conversions).

http://www.oooforum.org/forum/viewtopic.phtml?t=7242