Docx4J command line to convert doc/docx files to html [closed]
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer 开发者_如何学Cthe question.
Closed 5 years ago.
Improve this questionI have been trying to convert doc/docx files to html, the best bet I found is docx4j. Can anyone please help me with a straight command line to do this job.
I tried:
java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.CreateHtml [input.docx]
In response I would expect HTML output (either to the console or a file).
looking at http://dev.plutext.org/svn/docx4j/trunk/docx4j/docs/Docx4j_GettingStarted.html and the samples dir, i would think that
java -cp docx4j.jar:log4j-1.2.15.jar org.docx4j.samples.CreateHtml [input.docx]
should work. note the following from the Getting Started > Command Line Samples section:
If there are any images in the docx, you'd also need:
xmlgraphics-commons-1.4.jar commons-logging-1.1.1.jar
on your classpath.
Many thanks to ax for providing line of thought, but that command gave Class missing error so all was needed to include other jar files in path.
java -cp docx4j-2.6.0.jar:log4j-1.2.15.jar:xalan-2.7.1.jar:serializer-2.7.1.jar:xml-apis-1.3.04.jar:commons-logging-1.1.1.jar:commons-lang-2.4.jar:commons-io-1.3.1.jar:commons-codec-1.3.jar:xmlgraphics-commons-1.4.jar org.docx4j.samples.CreateHtml input.doc
精彩评论