GemBox.Spreadsheet 3.1 introduces support for generic HTML export.
HtmlExporterOptions object is an object that allows you to use all sort of options that will define the export process (custom methods, showGridLines, showRowNumbers, showColumnLetters, exportHiddenRows, exportHiddenColumns, …).
Every method of the export process can be easily replaced by a custom method that should have the same functionality as the default one. For example, you can replace the method that exports cell with your custom by simply creating HtmlExporterOptions object and writing the following line:
HtmlExporterOptions.MethodCellToHtml = CustomCellToHtml;
(default method for cell export is DefaultHtmlExporter.DefaultCellToHtml).
There are a few ways to export the file or a part of the file to HTML:
| Export method | Details |
|---|---|
| ExcelFile.SaveHtml(string, HtmlExporterOptions, bool) ExcelFile.SaveHtml(XmlTextWriter, HtmlExporterOptions, bool) | Exports the whole used range of the active worksheet to the specified file or XmlTextWriter. |
| CellRange.ExportToHtml(string, HtmlExporterOptions, bool) CellRange.ExportToHtml(XmlTextWriter, HtmlExporterOptions, bool) | Exports cell range to the specified file or XmlTextWriter. |
| DefaultHtmlExporter.DefaultPageToHtml(HtmlExporterOptions, CellRange) | Exports specified cell range to XmlDocument as XHTML page. |
| DefaultHtmlExporter.DefaultTableToHtml( HtmlExporterOptions, CellRange) | Exports specified cell range to XmlNode as XHTML table. |
| DefaultHtmlExporter.DefaultColumnLettersToHtml( HtmlExporterOptions, ExcelColumn, ExcelColumn) | Methods which represent parts of the export process. Each method exports a specified part to XmlNode or string as XHTML part. Each of these methods can be called to export just a part of the file as XHTML. |
| DefaultHtmlExporter.DefaultColumnLetterToHtml( HtmlExporterOptions, ExcelColumn, int) | |
| DefaultHtmlExporter.DefaultRowToHtml(HtmlExporterOptions, ExcelRow, CellRange, int) | |
| DefaultHtmlExporter.DefaultRowNumberToHtml( HtmlExporterOptions, ExcelRow, CellRange, int) | |
| DefaultHtmlExporter.DefaultCellToHtml(HtmlExporterOptions, ExcelCell, HtmlExportPosition) | |
| DefaultHtmlExporter.DefaultCellStyleToHtml(ExcelCell, HtmlExportPosition) | |
| DeDefaultHtmlExporter.DefaultCellValueToHtml(ExcelCell, HtmlExportPosition) |
Feel free to report any problems with HTML support to support@gemboxsoftware.com