How Java converts Word to HTML
Java how to turn Word into HTML, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
[program environment]
1. IntelliJ IDEA 2018 (jdk 1.8.0)
two。 Test documentation: Word 2013 (.docx)
3. Jar package: Free Spire.Doc for Java 3.9.0
There are two ways to import jar:
Method 1: download the jar package locally, decompress it, and import the Spire.Doc.jar under the local lib folder into the Java program, as follows:
Import results:
Methods in the 2:maven program, you need to configure the pom.xml file and specify the maven repository path and the dependency of spire.doc.free. The configuration content is as follows:
Com.e-iceblue http://repo.e-iceblue.cn/repository/maven-public/ e-iceblue spire.doc.free 3.9.0
[Java]
Import com.spire.doc.*;public class WordtoHtml {public static void main (String [] args) {Document doc = new Document (); doc.loadFromFile ("test.docx"); doc.saveToFile ("wordtohtml.html", FileFormat.Html); doc.dispose ();}} conversion effect
Word test documentation:
Converted HTML file:
Note: the file path in the code is the IDEA program project folder path, such as F:\ IDEAProject\ Conversion_Doc\ test.docx, and the file path can be customized to another path.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.