Great Yegor , Thank you very much for the detailed explanation with examples.
Now I got the flow ...... So I should refer the Master slide shape properties for the default shapes. Thanks once again Regards, Jebarlin Robertson.R On Mon, Nov 14, 2011 at 1:54 PM, Yegor Kozlov <[email protected]> wrote: > In general, the Presentation ML inheritance chain is as follows: > > Slide <-- SlideLayout <-- SlideMaster <-- default styles in SlideMaster > > That is, if a shape property is missing in slide.xml, you need to > lookup in the slide's layout and then in the master. The difference > between slide layout and slide master is that slide layout applies to > all slides of that type while slide master applies to all slides > regardless of their type. > > Example: Examine the structure of a title shape (note that none of the > shape properties are defined which means they all are taken from the > master sheet): > > <p:sp> > <p:nvSpPr> > <p:cNvPr id="2" name="Title 1"/> > <p:cNvSpPr> > <a:spLocks noGrp="1"/> > </p:cNvSpPr> > <p:nvPr> > <p:ph type="title"/> > </p:nvPr> > </p:nvSpPr> > <p:spPr/> > <p:txBody> > <a:bodyPr/> > <a:lstStyle/> > <a:p> > <a:r> > <a:rPr lang="en-US" dirty="0" smtClean="0"/> > <a:t>Office theme again</a:t> > </a:r> > <a:endParaRPr lang="en-US" dirty="0"/> > </a:p> > </p:txBody> > </p:sp> > > The link between a shape and its master shape is set via the > Placeholder element: > <p:ph type="title"/> > > this tells PowerPoint to lookup a shape with <p:ph type="title"/> in > the slide layout. Now we go there and get the master shape: > > <p:sp> > <p:nvSpPr> > <p:cNvPr id="2" name="Title 1"/> > <p:cNvSpPr> > <a:spLocks noGrp="1"/> > </p:cNvSpPr> > <p:nvPr> > <p:ph type="title"/> > </p:nvPr> > </p:nvSpPr> > <p:spPr/> > <p:txBody> > <a:bodyPr/> > <a:lstStyle/> > <a:p> > <a:r> > <a:rPr lang="en-US" smtClean="0"/> > <a:t>Click to edit Master title style</a:t> > </a:r> > <a:endParaRPr lang="en-US"/> > </a:p> > </p:txBody> > </p:sp> > > Still no luck with getting shape properties. Let's drill down deeper > to the master level: > > <p:sp> > <p:nvSpPr> > <p:cNvPr id="2" name="Title Placeholder 1"/> > <p:cNvSpPr> > <a:spLocks noGrp="1"/> > </p:cNvSpPr> > <p:nvPr> > <p:ph type="title"/> > </p:nvPr> > </p:nvSpPr> > <p:spPr> > <a:xfrm> > <a:off x="457200" y="274638"/> > <a:ext cx="8229600" cy="1143000"/> > </a:xfrm> > <a:prstGeom prst="rect"> > <a:avLst/> > </a:prstGeom> > </p:spPr> > <p:txBody> > <a:bodyPr vert="horz" lIns="91440" tIns="45720" rIns="91440" > bIns="45720" rtlCol="0" anchor="ctr"> > <a:normAutofit/> > </a:bodyPr> > <a:lstStyle/> > <a:p> > <a:r> > <a:rPr lang="en-US" smtClean="0"/> > <a:t>Click to edit Master title style</a:t> > </a:r> > <a:endParaRPr lang="en-US"/> > </a:p> > </p:txBody> > </p:sp> > > Gotcha! The xfrm element is found which tells you the position of the > title shape on the slide. > > You can find sample code that fetches shape properties in PPTX here: > > https://svn.apache.org/repos/asf/poi/trunk/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFSimpleShape.java > > See the fetchShapeProperty method and its usages. > > Hope my explanation helps. > > Yegor > > On Mon, Nov 14, 2011 at 9:39 AM, Jebarlin Robertson > <[email protected]> wrote: > > Thanks for your valuable reply Yegor > > > > I am using XSLFSlide and XSLFShape only. But If you don't change the > shape > > (Text Box) size or the position in PPTX, the shape properties are not > > present in the slide.xml file. > > > > So my doubt is from where i can take the default shape properties for the > > default shapes. > > > > I have masterSlide.xml and the slidelayout.xml. Which one need to be > > consider for the default shapes properties.? > > > > Jebarlin.R > > > > > > On Fri, Nov 11, 2011 at 7:28 PM, Yegor Kozlov <[email protected]> > wrote: > > > >> The simplest solution is to use the XSLF usermodel API: > >> > >> XMLSlideShow ppt = new XMLSlideShow(new > >> FileInputStream("presentation.pptx")); for(XSLFSlide slide : > >> ppt.getSlides()) { for(XSLFShape sh : slide){ > >> Rectangle2D anchor = sh.getAnchor(); String name = > >> sh.getShapeName(); > >> ..... } } > >> If you want to poke in the slide XML yourself, look at the xfrm bean > >> that holds 2D transform for shapes: > >> > >> <a:xfrm> > >> <a:off x="901700" y="1949450"/> > >> <a:ext cx="8285163" cy="2235200"/> > >> <a:chOff x="901700" y="2946400"/> > >> <a:chExt cx="8285163" cy="2235200"/> > >> </a:xfrm> > >> > >> All values are in EMUs (1pt = 12700 EMUs) > >> > >> Yegor > >> > >> On Fri, Nov 11, 2011 at 3:50 PM, Jebarlin Robertson > >> <[email protected]> wrote: > >> > Hi, > >> > > >> > Can anyone give me some sample code to get the shape and its property > >> from > >> > PPT (2007 format) document? > >> > > >> > > >> > I just want to know how to get the shape properties such as width, > hight, > >> > X, Y axis, from the XML, If these properties are not in the slide.xml > >> then > >> > how to get it from masterslide.xml? > >> > > >> > Thanks in Advance. > >> > > >> > > >> > Thanks and Regards, > >> > Jebarlin Robertson.R > >> > > >> > >> --------------------------------------------------------------------- > >> To unsubscribe, e-mail: [email protected] > >> For additional commands, e-mail: [email protected] > >> > >> > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > >
