Bringing in groupshape from template

I need to bring in shapes and modify them from several template presentations… however, no matter what way I try to build my slide, I can’t seem to access my shapes. From the API, I only see a title and subtitle shape, and not the shape that is from the template slide. I am cloning the slide and then trying to access the shapes using slide.getShapes()… When I open the output presentation I can see my shape, however. Is there a different way to do this?

Hello,

Could you please write in details what result would you like to achieve. The provided code definitely won’t work and should be changed.
1. GroupShape is on the master but you try to search it on a slide.
2. GroupShape.addTextFrame() method always throws exception by design because TextFrame can’t be added to a GroupShape and Table. You should create another shape (for example Rectangle) and add TextFrame to it.
3. Are you sure you need 2 presentations, slides cloning between them and changing master? If I understood your requirements right then everything can be done in almost one step and without any unsafe operations with masters.

alcrus:
Hello,

Could you please write in details what result would you like to achieve. The provided code definitely won't work and should be changed.
1. GroupShape is on the master but you try to search it on a slide.
2. GroupShape.addTextFrame() method always throws exception by design because TextFrame can't be added to a GroupShape and Table. You should create another shape (for example Rectangle) and add TextFrame to it.
3. Are you sure you need 2 presentations, slides cloning between them and changing master? If I understood your requirements right then everything can be done in almost one step and without any unsafe operations with masters.


Yes.. the reason I was creating two presentations is: ultimately, I will be pulling shapes, tables and formatting from multiple templates.. possibly 8-10 different template files, into one destination presentation. I tried creating a new slide and cloning and setting the master slide after simply cloning a single slide from the template into my new presentation did not work (had the same result)..

As far as the TextFrame, it's true that I've not yet been able to get the code to run to the point that it was finding the GroupShape, iterating the component shapes and adding the textframe. That loop never was being entered (it only found two regular AutoShapes), so it may very well throw an exception. I was hoping that the GroupShape consisted of regular autoshapes (not table, or other groupshapes) that could have a text frame added.. but I haven't gotten that far yet. Ultimately I was hoping to look at the alternative text in each component within the groupshape and use that to add customized text.

I am still having problems with this. I’ve concluded that something must be wrong with my source presentations, because even when I use the source template as a my final PowerPoint (no changing masters, etc), when I add a new slide, the library will not see the AutoShape in the master slide. It sees two rectangles, but neither of them were an Autoshape. I tried the same thing but with a regular table, but still only see the two rectangles (no Table objects). In the output slides, I can see the table or shape duplicated, but I cannot interact with them any further.

Hi,

If your problem is not solved, you can provide the source presentations alongwith the desired (target) presentation so that your issue can be investigated.