Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+
Row

IWorkbook.ExportToHtml(String, HtmlDocumentExporterOptions) Method

Exports the document’s data to the specified file in HTML format using the specified options.

Namespace: DevExpress.Spreadsheet

Assembly: DevExpress.Spreadsheet.v20.2.Core.dll

Declaration

void ExportToHtml(
    string fileName,
    HtmlDocumentExporterOptions options
)

Parameters

Name Type Description
fileName String

A String value which contains the full path (including the file name and extension) specifying where the HTML file will be created.

options HtmlDocumentExporterOptions

A HtmlDocumentExporterOptions instance containing required export options.

Example

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

workbook.LoadDocument("Documents\ExpenseReport.xlsx")
workbook.Calculate()
Dim worksheet As Worksheet = workbook.Worksheets(0)

' Create an object containing HTML export options.
Dim options As New HtmlDocumentExporterOptions()

' Set HTML-specific export options.
options.CssPropertiesExportType = DevExpress.XtraSpreadsheet.Export.Html.CssPropertiesExportType.Style
options.Encoding = Encoding.UTF8

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

' Export a document to an HTML file with the specified options.
workbook.ExportToHtml("OutputRange.html", options)

' Export the entire worksheet to a stream as HTML.
Dim htmlStream As New FileStream("OutputWorksheet.html", FileMode.Create)
workbook.ExportToHtml(htmlStream, worksheet.Index)
See Also