Free Support Forum - aspose.com

NullPointerException on using chart.toImage(...) API

Hi,


I am using the latest Aspose.Cells v17.4

On generating image of Chart1 in Sheet1 in the attached excel document [xlsx and xlxb] using the API chart.toImage(…),
we get the following null pointer exception.

java.lang.NullPointerException
at com.aspose.cells.zkd.a(Unknown Source)
at com.aspose.cells.zkd.c(Unknown Source)
at com.aspose.cells.zkd.a(Unknown Source)
at com.aspose.cells.zkd.a(Unknown Source)
at com.aspose.cells.zkd.a(Unknown Source)
at com.aspose.cells.Chart.a(Unknown Source)
at com.aspose.cells.Chart.toImage(Unknown Source)

However, this conversion of Chart to Image worked fine in aspose-cells-9.0.7.jar

Can you please look into this issue?

Thanks,
Jaspreet

Hi,


Thanks for the template files and stack trace.

After an initial test, I observed the issue as you mentioned by using the following sample code with your template file. I found an exception “java.lang.NullPointerException” when rendering the chart (in XLSX and XLSB files) to image file format. I also noticed some part of data source of the underlying chart is external which might be the reason to get this exception. Anyways, we got to evaluate the issue first.
e.g
Sample code:

Workbook workbook = new Workbook(“test_chart±+Copy.xlsx”);
Worksheet worksheet = workbook.getWorksheets().get(0);
Chart chart = worksheet.getCharts().get(“Sheet1”);
ImageOrPrintOptions imageOptions = new ImageOrPrintOptions();
imageOptions.setImageFormat(ImageFormat.getPng());
chart.toImage(“out1.png”, imageOptions);//Exception
chart.toPdf(“out2.pdf”);

I have logged a ticket with an id “CELLSJAVA-42268” for your issue. We will look into it soon.

Once we have an update on it, we will let you know here.

Thank you.

Hi,


Is there any update on this issue?

This issue is reported by our customer in their Production Environment, so it is of high priority to us.
Moreover, this a break from the earlier versions of Aspose.Cells library. It was working fine with Aspose.Cells v9.0.7.

Can you please look into this on priority and provide a fix asap.

Thanks,
Neha

Hi,


I am afraid, your issue is still pending for analysis. However, I have logged your concerns against your ticket “CELLSJAVA-42268” and asked the concerned developer from product team to evaluate the issue soon. Hopefully it will be done early next week and we could update you on it.

Thank you.

Hi,


This is to inform you that your issue has been fixed now. We will soon provide you the fixed version (Download link can be shared here in the next 3-5 days or so) after performing QA and incorporating other enhancements and fixes.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-42268) have been fixed in Aspose.Cells for Java 17.5.


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