HtmlDocumentExporterOptions.Range Property
Gets or sets the worksheet range to be exported to an HTML file.
Namespace: DevExpress.XtraSpreadsheet.Export
Assembly: DevExpress.Spreadsheet.v24.2.Core.dll
NuGet Package: DevExpress.Spreadsheet.Core
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
String | String. |
A String value that represents the exported range. |
#Remarks
You can specify a data range to be exported to HTML using one of the following methods:
- Provide the A1-style reference (relative, absolute or mixed) to the required cell range.
- Provide the R1C1-style reference (relative, absolute or mixed) to the required cell range.
- Provide the structured reference to a worksheet table or a table data range you wish to export.
- Assign a defined name that refers to a cell range you wish to export.
- Use a formula in the invariant culture (English) that returns a cell range to be exported.
Important
While exporting a cell range to an HTML file, you can reference only a contiguous cell range located in a worksheet specified by the Html
#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)
#Related GitHub Examples
The following code snippets (auto-collected from DevExpress Examples) contain references to the Range 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.