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

Free Support Forum - aspose.com

Change Series name

I have a simple presentation file with chart. Chart is based on some excel sheet, which have Series with name “Series1”.
I am trying to change it to other name, but can’t find how to do that. I can obtain it, but can’t find how to change it. Can you suggest if it is possible and if yes then how.
Presentation presentation = new Presentation(“chart_question.pptx”);
for (IShape iShape : presentation.getSlides().get_Item(0).getShapes())
{
if (iShape instanceof Chart)
{
Chart chart = (Chart)iShape;
//below will get Series1
String chartName = chart.getChartData().getSeries().get_Item(0).getName().toString();
}
}
using 14.6.0 aspose.slides for java.

Hi Andrey,

I have observed the requirements shared by you and suggest you to please try using the following sample code on your end to serve the purpose of changing series name. I hope this will work. Please share, if I may help you further in this regard.

public static void changeChartSeries()
{
String path=“D:\Aspose Data\”;
Presentation presentation = new Presentation(path+“chart_question.pptx”);
for (IShape iShape : presentation.getSlides().get_Item(0).getShapes())
{
if (iShape instanceof Chart)
{
Chart chart = (Chart)iShape;
//below will get Series1

chart.getChartData().getChartDataWorkbook().getCell(0, 0, 1).setValue(“New Series”);
String chartName = chart.getChartData().getSeries().get_Item(0).getName().toString();
int c=0;
}

}

presentation.save(path+“chart_question2.pptx”, SaveFormat.Pptx);
}


Many Thanks,