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.

View Example

static void buttonCustomAction_ItemClick_Html(object sender, ItemClickEventArgs e) {
    RichEditControl richEdit = e.Item.Tag as RichEditControl;
    richEdit.LoadDocument("Documents\\Grimm.docx");
    //Export document to the file:
    richEdit.SaveDocument("resultingDocument.html", DocumentFormat.Html);
    //Export document to the stream:
    using (FileStream htmlFileStream = new FileStream("Document_HTML.html", FileMode.Create)) {
        richEdit.SaveDocument(htmlFileStream, DocumentFormat.Html);
    }

    System.Diagnostics.Process.Start("resultingDocument.html");
}