Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Export a 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");
}
See Also