How to Make All Shapes as Group in a PowerPoint Presentation Slide in C#?

Hi,

Please suggest that how to make group of all shapes in a slide.

Thanks.

@eyenan4u

You can please try using following sample code to add the shape to group shape.

        Presentation pres = new Presentation("test.pptx");
        ISlide slide = pres.Slides[0];

        //Shape to be added to group shape
        IShape shapeTobeAddedinGroupShape = slide.Shapes[0];

        //Adding a group shape
        IGroupShape groupShape = slide.Shapes.AddGroupShape();

        //Adding exisiting shape inside group shape
        groupShape.Shapes.AddClone(shapeTobeAddedinGroupShape);

        //Removing the shape from slide
        slide.Shapes.Remove(shapeTobeAddedinGroupShape);

        pres.Save("saved.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

@mudassir.fayyaz

Thanks for sharing this, It is working fine.

@eyenan4u

It’s good to know that suggested option has worked.