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 is defined in the DevExpress.Docs.v19.1.dll assembly. Add this assembly to your project to use the workbook functionality. You require a license to the DevExpress Office File API or DevExpress Universal Subscription to use this assembly in production code. 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