Saving to HTML with some image problem

Hi Aspose team

We are working on Excel files’ HTML conversion for cross-platform viewing

And Here is our code for conversion test with Aspose Cells 9.0.0:

Workbook book = new Workbook(“custom/input/xlsx/diagramTest.xlsx”);
ByteArrayOutputStream baos = new ByteArrayOutputStream();

for (int i = 0; i < book.getWorksheets().getCount(); i++) {
Worksheet sheet = book.getWorksheets().get(i);
// only one page for test
if (i != 1) {
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(false);

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/stream.html”));

There 2 problems in this conversion test:
1. The size of image content is 0 byte, for example in this Excel file, a image called "chart_工作表1_0.png"
2. The diagram’s arrow is not shown correctly

I have uploaded a comparison image, the Excel file, and the result of this conversion.
Please check the attachment, and help us solve this issue, thank you.

Best,
Craig

Hi Craig,


Thank you for contacting Aspose support.

I have evaluated the presented scenario while using the latest version of Aspose.Cells for Java 9.0.7, and I am able to notice both mentioned issues. First of all, the chart “圖表 2” from your provided spreadsheet is of type Surface, which isn’t supported for rendering, that is the reason you are getting a 0 sized file for it. The other problem seems to be a bug of the API therefore I have raised a ticket with Id CELLSJAVA-42003 for incorrect rendering of the diagram “資料庫圖表 18”. Please spare us little time to properly analyze this incident and revert back with updates in this regard.

Hi,


Please try our latest version/fix: Aspose.Cells for Java v16.10.3 (attached).

We have fixed the issue regarding the shapes ("chart_工作表1_0.png). As mentioned earlier, the Surface chart is not supported. So the image size would be 0 byte.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-42003) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.

Hi Amjad Sahi


Thanks for your information.

With 16.11.0 the issue about arrows is checked to be fixed by my own test.
We will do some QA tests furthermore, and thanks for the help again.

P.S. Will Surface Chart be supported in the future?

Craig
Hi,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix in your initial testing. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

P.S.
Surface Chart will not be supported in near future. It make take years.

This issue has already been logged as

  • CELLSJAVA-40316 - Support for Surface Chart