Skip to main content
A newer version of this page is available. .

How To: Export Document to HTML format

This example demonstrates how to export the document to the HTML format using the RichEditControl.SaveDocument method.

The RichEditControl instance is passed to the BarItem.ItemClick event handler using the BarItem.Tag property.

Shared Sub buttonCustomAction_ItemClick_Html(ByVal sender As Object, ByVal e As ItemClickEventArgs)
    Dim richEdit As RichEditControl = TryCast(e.Item.Tag, RichEditControl)
    richEdit.LoadDocument("Documents\Grimm.docx")
    'Export document to the file:
    richEdit.SaveDocument("resultingDocument.html", DocumentFormat.Html)
    'Export document to the stream:
    Using htmlFileStream As New IO.FileStream("Document_HTML.html", IO.FileMode.Create)
        richEdit.SaveDocument(htmlFileStream, DocumentFormat.Html)
    End Using

    System.Diagnostics.Process.Start("resultingDocument.html")
End Sub