- How do we add an existing shape to a group?
- Do we com.aspose.slides.pptx.GroupShapeEx.getShapes()
I regret to share that adding new group shape to PPTX is not available at the moment. However, adding new shape to existing group shapes is available and that can be used. As a work around, you can use a template slide with GroupShape and then add your shape to that instance of group shape. For your kind reference, I have shared the code snippet, source and generated presentation. Please share, if I may help you further in this regard.
// Instantiate PresentationEx class that represents PPTX
PresentationEx pres = new PresentationEx("D:\\TestGroup.pptx");
// Access first slide
SlideEx sld = pres.getSlides().get(0);
// Iterate through shapes to find the placeholder
for (int i = 0; i < sld.getShapes().size(); i++)
if(shp instanceof GroupShapeEx)
//Getting AutoShape from group shapes set
GroupShapeEx gShape = (GroupShapeEx)shp;
int ind=gShape.getShapes().addAutoShape(ShapeTypeEx.RECTANGLE,300,200,100,100 );
// Write the PPTX to Disk
Thanks and Regards,