Skip to main content

HtmlDocumentExporterOptions.SheetIndex Property

Gets or sets the index of the worksheet to be exported to an HTML file.

Namespace: DevExpress.XtraSpreadsheet.Export

Assembly: DevExpress.Spreadsheet.v24.1.Core.dll

NuGet Package: DevExpress.Spreadsheet.Core

Declaration

[DefaultValue(0)]
public int SheetIndex { get; set; }

Property Value

Type Default Description
Int32 0

An integer value that is the index of the worksheet to be exported to HTML.

Remarks

To export only a part of the specified worksheet to HTML, use the HtmlDocumentExporterOptions.Range property.

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.

View Example

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)

The following code snippets (auto-collected from DevExpress Examples) contain references to the SheetIndex property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also