Using Aspose Cells for Java, version 17.11.
We’re using Aspose Cells in a server side application where we visualize Excel in HTML clients, overlaying the HTML exported with Aspose with additional data. The consumer of the HTML is a web browser. Importing the HTML back into Excel or Aspose is not relevant for us.
Workbook workbook = new Workbook("input.xlsx"); HtmlSaveOptions options = new HtmlSaveOptions(); Worksheet sheet = workbook.getWorksheets().get("Versioning"); workbook.getWorksheets().setActiveSheetIndex(sheet.getIndex()); options.setExportActiveWorksheetOnly(true); options.setExportBogusRowData(false); options.setExportFrameScriptsAndProperties(false); workbook.save("output.html", options);
See attached Excel input and HTML output files.html-irrelevant-data.zip (1.4 MB)
Some observations on the quality and usefulness of the output from Aspose Cells:
- The generated HTML contains over 5000 CSS styles, 99% of which are not used in the generated HTML. This amounts to multiple megabytes of unneeded CSS. Would it be possible to provide a property for HtmlSaveOptions (“ExcludeUnusedStyles”?), that would trigger Aspose Cells to only write out the CSS for styles actually being used by the Excel content being saved?
- Another large part of the output consists of <x:ExcelName> data, describing names defined in the workbook. Note that most (if not all) of the names being written by Aspose do not actually relate to the sheet being saved. As mentioned before, our use of the exported HTML is to show it in a web browser (on a PC or smartphone client), so in fact any of the Office-specific XML being embedded in the HTML is of no use for us. In fact, it consumes unneeded bandwidth and likely impacts performance without any benefit. Since we are not interested in being able to re-import the generated HTML into Excel or Aspose, we’d like to generate only content that is relevant to the viewer. An option to completely disable generation of the <x:ExcelWorkbook> element and content below it would be a great improvement for out use of Aspose Cells.
- A similar case applies to the <o:DocumentProperties> element generated by Aspose Cells. There is no use for this if the consumer is an HTML client. In addition, including this element might unintentionally expose privacy-sensitive data, so it would be good if there was an option controlling generation of this element.
Overall, we are quite happy with the fidelity of the HTML generated by Aspose Cells. However, for the use-case where the consumer of the HTML is a regular web-browser or smartphone, and re-import of the generated HTML is not needed, it would be nice to have more control to exclude irrelevant content from the exported HTML.