I'm trying to drill down through a shapetree in a PowerPoint slide to get a shape's placeholder values. The shape on the shapetree looks like this:
<p:sp>
<p:nvSpPr>
<p:cNvPr id="10" name="Text Placeholder 2"/>
<p:cNvSpPr>
<a:spLocks noGrp="1"/>
</p:cNvSpPr>
<p:nvPr>
<p:ph type="body" sz="quarter" idx="13" hasCustomPrompt="1"/>
</p:nvPr>
</p:nvSpPr>
<p:spPr>
<a:xfrm>
<a:off x="457200" y="3276601"/>
<a:ext cx="8229600" cy="838199"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</p:spPr>
<p:txBody>
<a:bodyPr lIns="91421" tIns="45710" rIns="91421" bIns="45710"/>
<a:lstStyle>
<a:lvl1pPr marL="0" indent="0" algn="ctr">
<a:buFontTx/>
<a:buNone/>
<a:defRPr sz="2400" b="1" baseline="0">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="+mj-lt"/>
<a:cs typeface="Arial" pitchFamily="34" charset="0"/>
</a:defRPr>
</a:lvl1pPr>
</a:lstStyle>
<a:p>
<a:pPr lvl="0"/>
<a:r>
<a:rPr lang="en-US" dirty="0" smtClean="0"/>
<a:t>Click to enter course title</a:t>
</a:r>
</a:p>
</p:txBody>
</p:sp>
The part I'm interested in getting looks like this:
<p:nvPr>
<p:ph type="body" sz="quarter" idx="13" hasCustomPrompt="1"/>
</p:nvPr>
I'm trying to get the idx
value (13, in this case).
The statement I'm using looks like this, so far (I'm saying "so far" because I don't know how to finish the statement):
var index = shape.NonVisualShapeProperties.NonVisualShapeDrawingProperties. <-???
At this point in the code, I have the shape I want, I just can't figure out how to get the placeholder values using Open Office SDK. I guess I could just treat it as plain old XML and get it by element name, but I figured the OOXML SDK would have some method built-in for this.
Finally figured out how to do this:
index = int.Parse(shape.NonVisualShapeProperties.ApplicationNonVisualDrawingProperties.PlaceholderShape.Index);
I was using NonVisualShapeDrawingProperties
when I should have been using ApplicationNonVisualDrawingProperties
.