GemBox.Document is a .NET component that enables you to read, write, edit, convert, and print document files from your .NET applications using one simple API.

Export Word to HTML file in C# and VB.NET

GemBox.Document allows you to convert between HTML and Word formats in C# and VB.NET.

The following example shows how to load a Word document and save it, together with all its images, into HTML or MHTML format.

Screenshot
Convert between HTML and Word Screenshot

See the full code below, use Run Example to execute.

Upload your file(Drag files here)

Download a sample file

using System;
using System.IO;
using System.Text;
using GemBox.Document;

class Sample
{
    [STAThread]
    static void Main(string[] args)
    {
        // If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY");

        DocumentModel document = DocumentModel.Load("HtmlExport.docx");

        // Images will be embedded directly in HTML img src attribute.
        document.Save("Html Export.html", new HtmlSaveOptions() { EmbedImages = true });
    }
}
Imports System
Imports System.IO
Imports System.Text
Imports GemBox.Document

Module Samples

    Sub Main()

        ' If using Professional version, put your serial key below.
        ComponentInfo.SetLicense("FREE-LIMITED-KEY")

        Dim document As DocumentModel = DocumentModel.Load("HtmlExport.docx")

        ' Images will be embedded directly in HTML img src attribute.
        document.Save("Html Export.html", New HtmlSaveOptions() With {.EmbedImages = True})

    End Sub

End Module

Check next sample.