AddGroupShape

AddGroupShape()

Creates a new empty group shape and adds it to the end of the shape collection. The group’s frame will automatically adjust to fit any shapes added to it.

public IGroupShape AddGroupShape()

Return Value

The newly created IGroupShape.

Examples

The following example shows how to add a group shape to a slide of PowerPoint Presentation.

[C#]
// Instantiate Prseetation class
using (Presentation pres = new Presentation())
{
    // Get the first slide
    ISlide sld = pres.Slides[0];
    // Accessing the shape collection of slides
    IShapeCollection slideShapes = sld.Shapes;
    // Adding a group shape to the slide
    IGroupShape groupShape = slideShapes.AddGroupShape();
    // Adding shapes inside added group shape
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 300, 100, 100, 100);
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 500, 100, 100, 100);
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 300, 300, 100, 100);
    groupShape.Shapes.AddAutoShape(ShapeType.Rectangle, 500, 300, 100, 100);
    // Adding group shape frame
    groupShape.Frame = new ShapeFrame(100, 300, 500, 40, NullableBool.False, NullableBool.False, 0);
    // Write the PPTX file to disk
    pres.Save("GroupShape_out.pptx", SaveFormat.Pptx);
}

See Also


AddGroupShape(ISvgImage, float, float, float, float)

Creates a new group shape, converts the specified SVG image into individual shapes, and adds the resulting group to the end of the shape collection.

public IGroupShape AddGroupShape(ISvgImage svgImage, float x, float y, float width, float height)
ParameterTypeDescription
svgImageISvgImageThe ISvgImage containing vector content to convert into shapes.
xSingleThe x-coordinate of the group’s frame, in points.
ySingleThe y-coordinate of the group’s frame, in points.
widthSingleThe width of the group’s frame, in points.
heightSingleThe height of the group’s frame, in points.

Return Value

The newly created IGroupShape.

See Also