// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java

//Create workbook
Workbook wb = new Workbook();

//Create an unused named style
wb.createStyle().setName("UnusedStyle_XXXXXXXXXXXXXX");

//Access first worksheet
Worksheet ws = wb.getWorksheets().get(0);

//Put some value in cell C7
ws.getCells().get("C7").putValue("This is sample text.");

//Specify html save options, we want to exclude unused styles
HtmlSaveOptions opts = new HtmlSaveOptions();

//Comment this line to include unused styles
opts.setExcludeUnusedStyles(true);

//Save the workbook in html format
wb.save("outputExcludeUnusedStylesInExcelToHTML.html", opts);