Convert Word to HTML using JAVA

HTML (Hyper Text Markup Language) is designed to display documents in a web browser. This article will demonstrate how to convert Word to HTML using Free Spire.Doc for Java.

Import JAR Dependency

Method 2: Directly add the jar dependency to maven project by adding the following configurations to the pom.xml.


Convert Word to HTML

  • Create a Document instance.
  • Load a Word document using Document.loadFromFile() method.
  • Save the document as an HTML file using Document.saveToFile() method.
import com.spire.doc.*;

public class WordToHtml {
public static void main(String[] args) {
//Create a Document instance
Document document = new Document();
//Load a Word document

//Save the document as HTML
document.saveToFile("toHtml.html", FileFormat.Html);



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store