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

Free Support Forum - aspose.com

Worksheet of type chart should return chart name as we see in Layout-->Chart name location

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 shouldn’t 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 v8.1.2.5
. 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());

Hi,

Thanks for using Aspose.Cells for Java.

Please download and try this fix: Aspose.Cells for Java v8.2.0.1 and let us know your feedback.

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.
(1)