Set Default Font while rendering spreadsheet to HTML
Contents
[
Hide
]
Aspose.Cells allows you to set default font while rendering spreadsheet to HTML. Please use the HtmlSaveOptions.DefaultFontName for this purpose. This property is useful when there are some cells in a spreadsheet that have invalid or non-existing fonts. Then those cells will be rendered in a font specified with the HtmlSaveOptions.DefaultFontName property.
Set Default Font while rendering spreadsheet to HTML
The following sample code creates a workbook and adds some text in cell B4 of the first worksheet and sets its font to some unknown/non-existing font. Then it saves the workbook in HTML by setting different default font names like Courier New, Arial, Times New Roman, etc.
The screenshot shows the effect of setting different default font names via HtmlSaveOptions.DefaultFontName property.
The code generates the output HTML file with Courier New, the output HTML with Arial, and the output HTML file with Times New Roman.
Sample Code