We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

java.lang.ClassCastException: com.aspose.cells.ChartPointCollection cannot be cast to java.lang.Iterable

Hi,

Using Aspose Cells for Java, version 21.8.

Sample code:

Workbook workbook = new Workbook("series.xlsx");
Worksheet sheet = workbook.getWorksheets().get(0);
ChartCollection charts = sheet.getCharts();
Chart chart = charts.get(0);
chart.calculate();
Series series = chart.getNSeries().get(0);
series.setValues("={10;20;30}");

Resulting exception:

Exception in thread "main" java.lang.ClassCastException: com.aspose.cells.ChartPointCollection cannot be cast to java.lang.Iterable
	at com.aspose.cells.Series.setValues(Unknown Source)
	at demo.Repro.main(Repro.java:23)

Input file:
series.zip (7.7 KB)

Kind regards,
Taras

@TarasTielkes,
The issue is reproduced and logged in our database for further investigation. You will be notified here once any update is ready for sharing.

This issue is logged as:
CELLSJAVA-43788 - Exception raised while setting value for chart series

@TarasTielkes,

Could you please try our latest fix (attached): Aspose.Cells for Java v21.8.5:
aspose-cells-21.8.5-java.zip

I have tested using your exact code and it works fine with it.

By the way, you may also change the line:
series.setValues("={10;20;30}");
to:
series.setValues("={10,20,30}");

if it makes any difference.

The issues you have found earlier (filed as CELLSJAVA-43788) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi