HtmlDocumentExporterOptions.CssPropertiesExportType Property
Gets or sets how the style sheets properties are exported.
Namespace: DevExpress.XtraSpreadsheet.Export
Assembly: DevExpress.Spreadsheet.v18.2.Core.dll
Declaration
[DefaultValue(CssPropertiesExportType.Style)]
public CssPropertiesExportType CssPropertiesExportType { get; set; }
Property Value
Type | Default | Description |
---|---|---|
CssPropertiesExportType | **Style** | A CssPropertiesExportType enumeration value specifying the export type. |
Available values:
Name | Description |
---|---|
Style | CSS is included in a <STYLE> tag. |
Link | CSS is included as a link to an external CSS-file. |
Inline | CSS is embedded by placing it as an attribute to an HTML tag. |
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.
Note
A complete sample project is available at https://github.com/DevExpress-Examples/winforms-spreadsheetcontrol-api-part-2-e4832
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)