Unable to add AutoShape to the Chart


Hi ,

I am facing problem while adding IAutoShape to chart usershape.

Aspose Slides Version -16.8.0

IShapeCollection iShapeCollection = iChart.getUserShapes().getShapes();
iShapeCollection.addAutoShape(ShapeType.Ellipse, 50, 50, 5, 5);


Kindly reply as soon as possible.

Hi Ankit,

I have observed your requirements and suggest you to please try using following sample code on your end to serve the purpose. I hope this will be helpful.

//Instantiate Prseetation class
Presentation pres = new Presentation();

//Get the first slide
ISlide sld = pres.getSlides().get_Item(0);

//Accessing the shape collection of slides
IShapeCollection slideShapes = sld.getShapes();
IChart chart = slideShapes.addChart(ChartType.ClusteredColumn, 100, 100, 400, 400);
IAutoShape ashp=chart.getUserShapes().getShapes().addAutoShape(ShapeType.Rectangle, 100, 100, 40, 40);
ashp.getTextFrame().setText(“Hello World”);

//Write the PPTX file to disk
pres.save(“c:\Aspose Data\GroupShape.pptx”, SaveFormat.Pptx);


Many Thanks,