java.lang.ArrayIndexOutOfBoundsException when saving xlsx file as html

Using Aspose.Cells for java 8.4.2.
When I am trying to save XLSX file as html - receive exception. Happens basically on attempt to save image, present inside file into file system.
Test file with problematic image attached. Snippet of code to reproduce this is below:

final static String BASE_FOLDER = “d:\temp\XLSX\”;

public static void main(String[] args) throws Exception
{
FileOutputStream fileOutputStream = new FileOutputStream(BASE_FOLDER + “colored_stream.html”);
PictureIExportObjectListener listener = new PictureIExportObjectListener();
Workbook workbook = new Workbook(BASE_FOLDER + “test2.xlsx”);
HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
htmlOptions.setExportActiveWorksheetOnly(true);
htmlOptions.setExportObjectListener(listener);
workbook.save(fileOutputStream, htmlOptions);
fileOutputStream.close();
}

public static class PictureIExportObjectListener implements IExportObjectListener
{
@Override
public Object exportObject(ExportObjectEvent exportObjectEvent)
{
final Object exportObjectEventSource = exportObjectEvent.getSource();
if (exportObjectEventSource instanceof ChartShape || exportObjectEventSource instanceof Picture
|| exportObjectEventSource instanceof TextBox || exportObjectEventSource instanceof CellsDrawing || exportObjectEventSource instanceof RectangleShape)
{
Picture testShape = (Picture)(exportObjectEventSource);
try
{
OutputStream fileOutputStream = new FileOutputStream(BASE_FOLDER + “pic.png”);
testShape.toImage(fileOutputStream, ImageFormat.getPng());
} catch (Exception e)
{
e.printStackTrace();
}
}

return StringUtils.EMPTY;
}
}

Hi,


Thanks for the template file and sample code.

Please try our latest version/ fix: Aspose.Cells for Java v8.4.2.8
I have tested your scenario/ case using your sample code and template file with v8.4.2.8, it works fine, it exported the image fine and I did not find any exception.

Let us know if you still have any issue.

Thank you.

Thanks. Issue is not reproduced with this library version.

Hi Andrey,


It is good to know that you are up & running again. Please feel free to contact us back in case you need our further assistance with Aspose APIs.