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

How to: Export a Document to HTML

  • 2 minutes to read

Important

The Workbook class in defined in the DevExpress.Docs.v17.2.dll assembly. Make sure you added a reference for this library to your project before using the workbook functionality. Note that use of this library in production code requires a license to the DevExpress Document Server or DevExpress Universal Subscription. Refer to the DevExpress Subscription page for pricing information.

The example below demonstrates how to save a worksheet as HTML file using the Workbook.ExportToHtml method. To specify export options, create an instance of the HtmlDocumentExporterOptions class and pass it as a parameter to the ExportToHtml method.

Dim worksheet As Worksheet = workbook.Worksheets("Grouping")
workbook.Worksheets.ActiveWorksheet = worksheet

Dim options As New HtmlDocumentExporterOptions()

' Specify the part of the document to be exported to HTML.
options.SheetIndex = worksheet.Index
options.Range = "B2:G7"

' Export the active worksheet to a stream as HTML with the specified options.
Using htmlStream As New FileStream("OutputWorksheet.html", FileMode.Create)
    workbook.ExportToHtml(htmlStream, options)
End Using

System.Diagnostics.Process.Start("OutputWorksheet.html")
See Also