Chart name in worksheet of type chart is incorrect

Hi,

I am using Aspose cells 8.1.
I get worksheet charts using below code.
The attached worksheet has a worksheet of type CHART by name MyChartSheet.
When I get charts, I get only one chart by name ‘Chart 1’. The image is of composite charts, which is fine but chart name should be ‘MyChartSheet’ as shown at Chart name option in Excel.
Click on chart sheet on white area–>go to chart tools–>go to layout --> Chart name

private Chart[] getCharts(com.aspose.cells.Worksheet worksheet) {
ChartCollection chartCollection = worksheet.getCharts();
Chart[] charts = new Chart[chartCollection.getCount()];
for (int i = 0; i < chartCollection.getCount(); i++) {
Chart chart = new Chart();
com.aspose.cells.Chart selectedChart = chartCollection.get(i);
chart.setName(selectedChart.getName());
charts[i] = chart;
}
return charts;
}

Thanks,
Jaspreet

Hi Jaspreet,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue after executing the following code using the latest version: Aspose.Cells for Java (Latest Version). Chart.getName() is returning the wrong chart name. It is returning “Chart 1” as chart name, it should return “MyChartSheet

We
have logged this issue in our database for investigation. We will look
into it and fix this issue. Once, the issue is resolved or we have some
other update for you, we will let you know asap.

This issue has been logged as CELLSJAVA-40956.

Java

String filePath = "F:\\Shak-Data-RW\\Downloads\\ChartSheet.xlsx";

Workbook workbook = new Workbook(filePath);

Worksheet worksheet = workbook.getWorksheets().get("MyChartSheet");

Chart chart = worksheet.getCharts().get(0);

System.out.println(chart.getName());

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


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