You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Yegor Kozlov <ye...@dinom.ru> on 2012/12/06 20:10:09 UTC

Fwd: Grouping & Ungrouping shapes in PPTx files

---------- Forwarded message ----------
From:  <an...@jpmchase.com>
Date: Thu, Dec 6, 2012 at 6:33 PM
Subject: Grouping & Ungrouping shapes in PPTx files
To: yegor.kozlov@dinom.ru


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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: Grouping & Ungrouping shapes in PPTx files

Posted by Yegor Kozlov <ye...@dinom.ru>.
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 <ye...@dinom.ru> wrote:
> ---------- Forwarded message ----------
> From:  <an...@jpmchase.com>
> Date: Thu, Dec 6, 2012 at 6:33 PM
> Subject: Grouping & Ungrouping shapes in PPTx files
> To: yegor.kozlov@dinom.ru
>
>
> 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: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org