Hello!
I am using aspose cloud to get all the shapes on a slide, however I am struggling to get all the sub_shapes within a group_shape. I see that get_shape allows you to specify the sub_shape index, but this only works if you know that index. Is there a way to request all the sub_shapes within a group? If not, is there a way to get the number of sub_shapes in a group? Right now, I am just blindly requesting get_shape and incrementing the sub_shape index until I get an out of bounds error.
-Jamie
EDIT: Alternatively, is it possible to copy an entire group_shape with all of it’s sub_shapes?
EDIT2: Alternatively, is it possible to even create a group shape using aspose cloud?
To retrieve a list of subshapes withing a group shape, you should use GetShapes method, and specify the index of your group shape as the value of “subshape” parameter.
For example, if your group shape is the 4th of the 1st slide, the request url would be like as follows, https://api.aspose.cloud/v3.0/slides/MyPres.pptx/slides/1/shapes?subshape=4
To clone a group shape, just as with any other shape type, you should use CreateShape method, and specify the index of your group shape as the value of cloneIndex parameter. Note that your can only clone shapes within one slide.
To create a group shape, you also use CreateShape method. For this task, you should use it several times: first, to create the group shape (an empty one), and then to add subshapes to it. To add subshapes, you need to call CreateShape method, and specify the index of your group shape as the value of “subshape” parameter.
You can also check out our docs about group shapes.
I hope it helps.
Please ask further if anything remains unclear.
1 - Maybe I misunderstand, but I don’t think this works for me. I want to list all the subshapes in a group shape. I don’t know what their indices are. I don’t even know how many there are. I want to retrieve all of the subshapes. At the very least, I would like to know how many there are in the group. Is there a way to do this? The getShapes method you linked assumes that I know the subshape index ahead of time, which is not the case.
2 - Not sure I understand your second point either. I can successfully clone group shapes, but so far every time I have done so it ONLY clones the group. It does not clone the subshapes inside of that group.
3 - That makes sense. Although if possible, i would love to copy over the entire group shape rather than recreate it from the ground up (ie it would be easier if I could use the method I am trying in #2).
Let’s say you have a presentation file “sample.pptx” and the first slide contains three shapes. Let’s say the third shape is a group shape. Then you can get all the shapes contained in the group shape like this:
Hi,
First off thank you for your continual help in resolving this issue. I really appreciate it
I should mention for context that I am using the python sdk, so rather than calling these endpoints directly I am using the methods provided. Also for context, my ultimate goal is to copy over a group shape from one slide to another.
The clone shape method you mentioned seems very helpful - in the sdk it looks like I use it this way:
However, there does not seem to be a way to set the destination slide if I use the shape_to_clone param (if I set slide_index to the source, I am told that the shape_to_clone index is out of bounds).
I CAN set slide_index to my destination slide if I use the dto param instead of the shape_to_clone param, but that leads to the aforementioned problem of the “outer” group shape being copied without any of the subshapes.
@jamieMacabacus,
You are right. The create_shape method does not allow specifying a target slide when cloning a shape.
We have opened the following new ticket(s) in our internal issue tracking system and will consider your requirements according to the terms mentioned in Free Support Policies.
Issue ID(s): SLIDESCLOUD-2009
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.