Hi there
We are working on saving Excel files into HTML format with Aspose Cells.
With Aspose Cells 17.4.0, Visio object in Excel files seems not rendered in the HTML result.
Here is our test code:
String fileName = “PusheenVisio-20170427.xlsx”;
Workbook book = new Workbook(“custom/input/xlsx/” + fileName);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
File f = new File(“custom/output/xlsx/” + fileName + “/”);
f.mkdirs();
for (int page = 0; page < book.getWorksheets().getCount(); page++) {
baos.reset();
for (int i = 0; i < book.getWorksheets().getCount(); i++) {
book.getWorksheets().get(i).setVisible(true);
}
for (int i = 0; i < book.getWorksheets().getCount(); i++) {
// only one page for test
if (i != page) {
book.getWorksheets().get(i).setVisible(false);
}
}
HtmlSaveOptions saveOps = new HtmlSaveOptions();
saveOps.setClearData(false);
saveOps.setCreateDirectory(false);
saveOps.setExportActiveWorksheetOnly(false);
saveOps.setExportHiddenWorksheet(false);
saveOps.setParseHtmlTagInCell(true);
saveOps.setEncoding(Encoding.getUTF8());
saveOps.setHiddenRowDisplayType(HtmlHiddenRowDisplayType.REMOVE);
saveOps.setHiddenColDisplayType(HtmlHiddenColDisplayType.REMOVE);
saveOps.setExportImagesAsBase64(true);
saveOps.setStreamProvider(new IStreamProvider() {
@Override
public void initStream(StreamProviderOptions arg0) throws Exception {
arg0.setStream(new ByteArrayOutputStream());
}
@Override
public void closeStream(StreamProviderOptions arg0) throws Exception {
System.out.println(arg0.getDefaultPath());
OutputStream stream = arg0.getStream();
if (stream instanceof ByteArrayOutputStream) {
ByteArrayOutputStream bb = (ByteArrayOutputStream) stream;
IOUtils.write(bb.toByteArray(),
new FileOutputStream(“custom/output/xlsx/” + arg0.getDefaultPath()));
}
}
});
book.save(baos, saveOps);
IOUtils.write(baos.toByteArray(),
new FileOutputStream(“custom/output/xlsx/” + fileName + “/” + (page + 1) + “.html”));
}
I also uploaded a example Excel file and the result.
Please check the attachment.
If there is any option to enable it, please tell me, thank you~
Craig