About HtmlSaveOptions.setExcludeUnusedStyles(true)

When using Aspose.Cells 20.12 to convert Excel to HTML, if excludeUnusedStyles is set to true, the content of cells D3 and E3 might all turn black. Upon checking the browser console, it was found that the CSS style corresponding to the class attribute of the font node was missing. If set to false, the final HTML output is normal. I would like to know how this setting determines which styles are unused.
sample code like this:

Workbook workbook = new Workbook("test.xlsx");
HtmlSaveOptions options = new HtmlSaveOptions();
options.setExportActiveWorksheetOnly(true);
options.setExcludeUnusedStyles(true);
options.setHiddenColDisplayType(HtmlHiddenColDisplayType.HIDDEN);
options.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.HIDDEN);
workbook.save("test.html", options);

aspose-upload.zip (85.4 KB)

@xuerui

  • Can you confirm if the issue occurs with all Excel files or only specific ones like “test.xlsx”?
  • Are cells D3 and E3 formatted with custom styles or using default cell styling?
  • Do D3 and E3 contain formulas, references, or conditional formatting that might affect style evaluation?
  • Is the missing CSS class referenced elsewhere in the HTML when excludeUnusedStyles = false?
  • Have you tested this behavior in a newer version of Aspose.Cells to see if the issue persists?

@xuerui,

Please try using our latest version/fix: Aspose.Cells for Java v25.12.

I have tested your scenario/case with Aspose.Cells for Java v25.12 using your template Excel file and sample code snippet, it works fine and as expected. The contents of cells D3 and E3 are OK. Please find attached the output HTML file for your reference.
test.zip (6.1 KB)

Let us know your feedback after using the latest version/fix of Aspose.Cells for Java.