We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding shapes to a groupshape

How do I add shapes to a groupshape? I’m trying to combine two shapes (one Autoshape & one Rectangle) into a single groupshape. I tried to serialize each and add the shape that via gs.Shapes.Add(ms), but no dice. Is there a way to get this done?

Dear cbaker,

I am afraid, you cannot create group shapes, nor you can serialize them. You can only add other shapes into the already existing groupshape.

Right, I figured out as much. So, how do I add other shapes into the already existing groupshape. Like how would I add an autoshape to an existing groupshape?

Dear cbaker,

To add shape in a groupshape you will serialize the shape and add it into the GroupShape.Shapes collection using GroupShape.Shapes.Add method.

Here is a code that does it. Source presentation, code and resulting output presentation is attached.

Presentation srcPres = new Presentation(@"c:\srcGroupShape.ppt");

Slide sld = srcPres.GetSlideByPosition(1);

AutoShape upArrow = sld.FindShape("UP-ARROW") as AutoShape;

AutoShape downArrow = sld.FindShape("DOWN-ARROW") as AutoShape;

GroupShape gshp = srcPres.GetSlideByPosition(2).FindShape("GROUPSHAPE") as GroupShape;

//Serialize the up and down arrow and add it into the gshp

MemoryStream ms = new MemoryStream();


ms.Position = 0;


ms = new MemoryStream();


ms.Position = 0;



Below is another workaround for copying group shape from another slide that you might find more suitable.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Here, I am pasting a code; it reads a sample source presentation namely grpShape.ppt, which has a group shape on the first slide.

Then, it adds a new slide inside it and copy the group shape there, finally write the presentation on disk namely output.ppt. The only limitation is that individual shapes don't remain grouped.

C# Code


//Read the source presentation

Presentation pres = new Presentation(@"c:\groupShape.ppt");

//Read the first slide

Slide sld = pres.GetSlideByPosition(1);

//Read the only group shape that is present in source presentation

GroupShape grpShp = sld.Shapes[0] as GroupShape;

//Get the count of the group shapes and allocate memory

//for those many shapes

MemoryStream[] msShapes = new MemoryStream[grpShp.Shapes.Count];

//Iterate all the shapes inside the groupshape and serialize them

int idx = 0;

foreach (Shape shp in grpShp.Shapes)


msShapes[idx]= new MemoryStream();

msShapes[idx].Position = 0;


msShapes[idx].Position = 0;



//Now we will add a new slide and add all the serialized shapes


sld = pres.AddEmptySlide();

//Iterate all serialized shapes and add them

foreach (MemoryStream ms in msShapes)




//Write the output presentation on disk

//Open the output presentation, it has shapes just like groupshape

//only limitation is that they are not grouped

//If we already had a groupshape, we could add them in its shapes collection



Is there any way to create a GroupShape from scratch ? Please give me a pointer if there is a way. If not can you please specify a time frame when it will be supported ?


Dear Mani,

I regret to inform you that the feature of adding group shape in PPT/PPTX is currently unavailable. An issue with ID 19279 has been created in our issue tracking system to look in to the possibility of providing the feature support. This thread has also been linked with the issue, so that you may be automatically notified, once the feature is available. Currently, you may access the group shapes and can add contents inside them.

We are sorry for your inconvenience,

Has there been any progress on adding possibility to add group shapes since 2010? Particularly for Java? Can’t find how to do that.

Hi Andrey,

I have verified the issue status from our issue tracking system and regret to share that the support for adding the group shapes from scratch is currently unavailable in Aspose.Slides. The concerned issue is blocked owing to implementation of merged API for Aspose.Slides for .NET that will provide single interface for both PPT and PPTX. The said API is expected to be available during Q4 of 2013. Once it will be provided for .NET, it will then be ported to Aspose.Slides for Java as well subsequently. We will share the good news with you as soon as the feature support will be available.

Many Thanks,

The issues you have found earlier (filed as SLIDESNET-19279) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.