Page 1 of 1

Slidelayout placeholders are not present in slide

PostPosted: Sun Sep 01, 2013 5:21 pm
by praveenbnsm
Hi,

I'm facing an issue with creating a slide from a slideLayout. My SlideLayout has some placeholder shapes. But after creating the slide(slide1) with that slideLayout, I don't see any of of those placeholder shapes in /ppt/slides/slide1.xml.

This is how i'm creating a slide using that slideLayout.

SlideLayoutPart introSlideLayout = (SlideLayoutPart)pmlPackage.getParts().get(new PartName("/ppt/slideLayouts/slideLayout1.xml"));
SlidePart introSlide = PresentationMLPackage.createSlidePart(mpp, qbrIntroSlideLayout, new PartName("/ppt/slides/slide1.xml"));

I've even referred to the docx4j source code on how the slide is being created. By default, it's creating only the following XML for the slide.

public final static String COMMON_SLIDE_DATA =
"<p:cSld xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:p=\"http://schemas.openxmlformats.org/presentationml/2006/main\">"
+ "<p:spTree>"
+ "<p:nvGrpSpPr>"
+ "<p:cNvPr id=\"1\" name=\"\"/>"
+ "<p:cNvGrpSpPr/>"
+ "<p:nvPr/>"
+ "</p:nvGrpSpPr>"
+ "<p:grpSpPr>"
+ "<a:xfrm>"
+ "<a:off x=\"0\" y=\"0\"/>"
+ "<a:ext cx=\"0\" cy=\"0\"/>"
+ "<a:chOff x=\"0\" y=\"0\"/>"
+ "<a:chExt cx=\"0\" cy=\"0\"/>"
+ "</a:xfrm>"
+ "</p:grpSpPr>"
+ "</p:spTree>"
+ "</p:cSld>";

Do we need to explicitly copy the shapes from slideLayout to slide or Am I doing something wrong ? I've seen a class called ResolvedLayout but don't know how to use it.

Please provide assistance in resolving this issue.

-Thanks,
Praveen

Re: Slidelayout placeholders are not present in slide

PostPosted: Mon Sep 02, 2013 12:17 am
by jason
Hi, its not entirely obvious what content in the layout should be copied, and how it should be modified in the process.

Could you please help me to understand why you want placeholder shapes on your slide? Is it for some kind of interactive or editing application?

Re: Slidelayout placeholders are not present in slide

PostPosted: Mon Sep 02, 2013 10:24 pm
by praveenbnsm
Hi Jason,

We're trying to generate pptx files programmatically based on input from APIs. As the layout of the slide won't change and only the data changes, we thought of creating the palceholders in layout, so that all the slides created from that slide layout will inherit them. And substitute the placeholders with the respective values which we got from the API.

If I create a slide manually from a slideLayout, all the placeholders are appearing in the slide also. But not the case when I created the slide programmatically from that slide layout.

Hope from this you come to know why we use placeholders.

-Thanks,
Praveen

Re: Slidelayout placeholders are not present in slide

PostPosted: Fri Aug 19, 2016 10:07 pm
by Alexand3r
Hey Jason,

is there any solution for the topic the previous users discussed?
I´m facing this problem right now and would be really glad if you have any advice for me how to do this :)

Thanks a Lot,
Alex

Re: Slidelayout placeholders are not present in slide

PostPosted: Mon Aug 22, 2016 1:48 pm
by jason
Please see new sample https://github.com/plutext/docx4j/blob/ ... older.java
as a starting point.

Re: Slidelayout placeholders are not present in slide

PostPosted: Mon Aug 22, 2016 6:35 pm
by Alexand3r
Hey Jason,
Thank you for your fast answer. That looks really helpful.

Thanks a lot,
Alex