You can't add existing shapes to XSLFGroupShape, but you can create a
new shape and copy contents of an existing shape into it :

        XSLFAutoShape existingShape = ...;
        group.createAutoShape().copy(existingShape);

        XSLFTextBox existingTextBox = ...;
        group.createTextBox().copy(existingTextBox)

> 2. Is there a way to Ungroup shapes in a PPTx file?

No, it is not supported. Ungroupping is not that simple: the code will
need to iterate over group, convert each shape's XML into non-group
form. Then it needs to transform anchors to the parent coordinate
system (slide or parent group if it is a nested group) and finally
delete the shape from the group and re-attach it to the parent.

Yegor

On Thu, Dec 6, 2012 at 11:10 PM, Yegor Kozlov <[email protected]> wrote:
> ---------- Forwarded message ----------
> From:  <[email protected]>
> Date: Thu, Dec 6, 2012 at 6:33 PM
> Subject: Grouping & Ungrouping shapes in PPTx files
> To: [email protected]
>
>
> Hi Yegor,
>
> I have two queries regarding groups:
>
> 1. While it is possible to create new shapes in a group, I couldn't
> find a way to add existing shapes to an XSLFGroupShape object. Is this
> possible?
>
> 2. Is there a way to Ungroup shapes in a PPTx file?
>
> Thanks,
> Ankit

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to