Export Worksheet CSS Separately in Output HTML

Possible Usage Scenarios

Aspose.Cells provides the feature to export worksheet CSS separately when you convert your Excel file to HTML. Please use HtmlSaveOptions.ExportWorksheetCSSSeparately property for this purpose and set it true while saving Excel file to HTML format.

Export Worksheet CSS Separately in Output HTML

The following sample code creates an Excel file, adds some text in cell B5 in Red color and then saves it in HTML format using HtmlSaveOptions.ExportWorksheetCSSSeparately property. Please see the output HTML generated by the code for a reference. You will find stylesheet.css inside it as an outcome of the sample code.

Sample Code

Export single sheet workbook to HTML

When a workbook with multiple sheets is converted to HTML using Aspose.Cells, it creates a HTML file along with a folder containing CSS and multiple HTML files. When this HTML file is opened in browser, the tabs are visible. Same behaviour is required for a workbook with single worksheet when it is converted to HTML. Earlier no separate folder was created for single sheet workbooks and only HTML file was created. Such HTML file does not show tab when opened in browser. Excel creates proper folder and HTML for single sheets also and hence same behaviour is implemented using Aspose.Cells. Sample file can be downloaded from the following link for using in the sample code below:

sampleSingleSheet.xlsx

Sample Code