AddGroupShape

AddGroupShape()

Creates a new GroupShape and adds it to the end of the collection. GroupShape frame size and position will be fitted to content when new shape will be added into the GroupShape.

public IGroupShape AddGroupShape()

Return Value

Created GroupShape object.

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 GroupShape, fills it with converted shapes from SVG and adds it to the end of the collection.

public IGroupShape AddGroupShape(ISvgImage svgImage, float x, float y, float width, float height)
ParameterTypeDescription
svgImageISvgImageSvg image object ISvgImage
xSingleThe X coordinate for the left side of the shape group frame.
ySingleThe Y coordinate for the top side of the shape group frame.
widthSingleThe width of the group of the shape group frame.
heightSingleThe height of a group of the shape group frame.

Return Value

Created GroupShape object.

See Also