Free Support Forum - aspose.com

Multiple chartex on one slide

I have got a bar chart and scatter graph on a single slide… I was wondering if it is possible for me to check the ChartEx whether its a scatter or a bar before without using alt tag…

Hi Jim,


Thanks for your interest in Aspose.Slides.

Please use the following sample code whereby I have identified chart on the basis of its type. Please share, if I may help you further in this regard.

public static void GetChartTypes()
{
Aspose.Slides.Pptx.PresentationEx pres = new Aspose.Slides.Pptx.PresentationEx(@“Source.pptx”);

foreach (Aspose.Slides.Pptx.SlideEx slide in pres.Slides)
{
foreach (Aspose.Slides.Pptx.ShapeEx aShape in slide.Shapes)
{
if (aShape is ChartEx)
{
ChartEx chart = (ChartEx)aShape;

if (chart.Type == ChartTypeEx.Scatter)
{
Console.WriteLine(“Chart is Scattered”);
}
else if (chart.Type == ChartTypeEx.ClusteredBar)
{
Console.WriteLine(“Chart is Clustered Bar”);
}

}
}
}
}


Many Thanks,

thanks this was very helpful