Convert Word and HTML files in C# and VB.NET

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

The following sample 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)

1using System;
2using System.IO;
3using System.Text;
4using GemBox.Document;
5
6class Sample
7{
8    [STAThread]
9    static void Main(string[] args)
10    {
11        // If using Professional version, put your serial key below.
12        ComponentInfo.SetLicense("FREE-LIMITED-KEY");
13
14        DocumentModel document = DocumentModel.Load("HtmlExport.docx");
15
16        // Images will be embedded directly in HTML img src attribute.
17        document.Save("Html Export.html", new HtmlSaveOptions() { EmbedImages = true });
18    }
19}
1Imports System
2Imports System.IO
3Imports System.Text
4Imports GemBox.Document
5
6Module Samples
7
8    Sub Main()
9
10        ' If using Professional version, put your serial key below.
11        ComponentInfo.SetLicense("FREE-LIMITED-KEY")
12
13        Dim document As DocumentModel = DocumentModel.Load("HtmlExport.docx")
14
15        ' Images will be embedded directly in HTML img src attribute.
16        document.Save("Html Export.html", New HtmlSaveOptions() With {.EmbedImages = True})
17
18    End Sub
19
20End Module

Check next sample or find out more about GemBox.Document and GemBox Software.