Convert Word to HTML in C#, VB.NET

Word to html conversion enables programmers and developers to create html through editing and degining word. Finally convert word to html. This section will introduce a solution to convert word to html via a .NET Word component with C#, VB.NET.

Spire.Doc for .NET, a professional word component, without installing MS Word, enables you to convert word to html with two lines of key code. One is Document.LoadFromFile(string fileName) method which is used to load your word file from system. The other is Document.SaveToFile(string fileName, FileFormat fileFormat) that is responsible to save word as html file.

Here you can view the effect of word to html conversion task. Please feel free to download Spire.Doc for .NET and view the detail code after the picture above.

Word to HTML

using Spire.Doc;
using Spire.Doc.Documents;

namespace Word_to_HTML
    public partial class Form1 : Form
        public Form1()

        private void button1_Click(object sender, EventArgs e)
            //Create word document
            Document document = new Document();

            //Save doc file to html
            document.SaveToFile("toHTML.html", FileFormat.Html);

        private void WordDocViewer(string fileName)
            catch { }

Imports Spire.Doc
Imports Spire.Doc.Documents

Namespace Word_to_HTML
    Public Class Form1
        Inherits Form
        Public Sub New()
        End Sub
        Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs)
            'Create word document
            Dim document As Document = New Document
            'Save doc file to html
            document.SaveToFile("toHTML.html", FileFormat.Html)
        End Sub
        Private Sub WordDocViewer(ByVal fileName As String)
            Catch  As System.Exception
            End Try
        End Sub
    End Class
End Namespace

Spire.Doc is a Microsoft Word component, which enables users to perform a wide range of Word document processing tasks directly, such as generate, read, write and modify Word document in WPF, .NET and Silverlight.