Join
Sign in
Search Options
Search Everything
Search Formats
Home
Blog
Resources
Forums
About Open XML
More ...
Home
»
Forums
»
Formats
»
PresentationML
»
Preset Shapes
Re: Preset Shapes
Formats
Discussions about working with different Open XML Formats
Get this RSS feed
Details
11
Replies
1
Subscriber
Posted
over 3 years ago
Options
Subscribe via RSS
Share this
PresentationML
Preset Shapes
rated by 0 users
This post has
11 Replies |
1
Follower
dvd
180
Posted by
dvd
on
Tue, Sep 8 2009 8:20 AM
rated by 0 users
Post Points: 5
Preset Shapes
Does anybody have an ideea hoe I can get the Preset shapes Path from a pptx file ?
All i get is a string, that doesn't give me the shape path ... and for "heart" or "smiley" :|
For now I took the path from an OpenXmlElement that I created by converting the preset shape
to freeform.
Can I do something else?
dvd
180
Posted by
dvd
on
Tue, Sep 15 2009 6:18 AM
rated by 0 users
Post Points: 20
Re: Preset Shapes
Anybody ... I find hard to believe I'm the first stuck in this ... anyway done that ...
However ... in adjLst we have some formulas that I can't figure out how to interpret.
For example, if we draw a right arrow, it appears like this:
<a:prstGeom prst="rightArrow">
<a:avLst>
<a:gd name="adj1" fmla="val 50000"/>
<a:gd name="adj2" fmla="val 50000"/>
</a:avLst>
</a:prstGeom>
What unit is that 50000? It doesn't have a one on one equivalence with vml adjustment list :|
Please help ,
Dvd
tendoors
555
Posted by
tendoors
on
Sun, Sep 20 2009 3:42 PM
rated by 0 users
Post Points: 20
Re: Preset Shapes
You need to get these values from the Ecma files, under a folder called "PresetShapeDefinitions.xml"
Note that the shapes are DrawingML, not VML. Units are usually measured in EMU.
dvd
180
Posted by
dvd
on
Mon, Sep 21 2009 6:39 AM
rated by 0 users
Post Points: 5
Re: Preset Shapes
Thanks !
I did that but now I can't seem to understand the meaning of ahLst ...
and some of the shapes are displayed incorrectly.
I couldn't get the meaning from documentation.
how do I use this element?
based on this I get the real value for adjustments?
Let's take for example roundRect
<ahLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main">
<ahXY gdRefX="adj" minX="0" maxX="50000">
<pos x="x1" y="t" />
</ahXY>
</ahLst>
How do I interpret this ... ?
dvd
180
Posted by
dvd
on
Mon, Sep 21 2009 8:23 AM
rated by 0 users
Post Points: 20
Re: Preset Shapes
And more important who tells me how is the scale made on some elements.
More precisely ... The rounded rectangle has the same radius on x and y, no matter how much are the width and height ... and as I observed it takes the minimum value between the w and h to scale the rounded portion.
Any ideas here?
Thanks,
dvd
tendoors
555
Posted by
tendoors
on
Tue, Sep 22 2009 1:29 AM
rated by 0 users
Post Points: 5
Re: Preset Shapes
Hi dvd, I'm not entirely sure I understand your question. All of the tags are defined in the Ecma specs, so you can find them there.
It may be helpful for you to create a FreeForm shape in PPT and then view the DrawingML created for that. The main difference between that freeform one and an Autoshape is that the values for the Autoshape are pre-defined and only a few tags are needed that would change the AutoShape, like or "adjustment handle list".
Please supply more details about what is confusing, what you are trying to do and then I can try to help more.
tendoors
555
Posted by
tendoors
on
Tue, Sep 22 2009 1:34 AM
rated by 0 users
Post Points: 20
Re: Preset Shapes
In re-reading your post above, I think you're asking "how does an app know what the value for adjustments are?" Is that correct? If so, the default ones are used as described in the presetshapedefinitions.xml doc *unless* you've changed them in your docx/pptx/xlsx, in which case the new adjustment value is there in the DrawingML portion of your document and the AutoShape is changed based on those values. So in the case of roundRect, unless you've changed anything, it will use the default calcs.
dvd
180
Posted by
dvd
on
Tue, Sep 22 2009 11:53 AM
rated by 0 users
Post Points: 20
Re: Preset Shapes
That's not what I was asking.
the problem that I am experiencing is the following:
I have a rounded rectangle or whatever else Preset Shape.
for this case I have an adjustment defined as x1, witch is the radius of the rounded part.
This is a dimension that is scaled to 21600, 21600.
If I draw a rounded rectangle with the width != height the, I scale the path definitions to W and H that the slide give me.
So, if I have a x1 = 10800 and width = 100, height = 200 => x1 = 50.
But if I scale to W and H => i will obtain 50 and 100 => will get an ellipse.
But instead, by trying I see that 50 is the answer, meaning I should take the minimum from W and H. If we take a W = 200 and H = 100 => x1 = 50
How can I get from the xml to with dimension should I scale a certain parameter.
I hope is clear now ... and I hope it's something I don't get because this means I should do some weird hacks to get a correct output.
Thanks,
Dvd
tendoors
555
Posted by
tendoors
on
Tue, Sep 22 2009 12:21 PM
rated by 0 users
Post Points: 20
Re: Preset Shapes
Got it, understood. In this case you need to calculate it based off the guide list. In the case of roundRect, the calcs are:
gdLst xmlns="http://schemas.openxmlformats.org/drawingml/2006/main"
gd name="a" fmla="pin 0 adj 50000" /
gd name="x1" fmla="*/ ss a 100000" /
gd name="x2" fmla="+- r 0 x1" /
gd name="y2" fmla="+- b 0 x1" /
gd name="il" fmla="*/ x1 29289 100000" /
gd name="ir" fmla="+- r 0 il" /
gdLst
You'll notice that the second one, "x1" sends in "ss", which means shortest side of either "a" (your adjustment calc above) or 100000 (which is a basic Min (x, y) calculation). The Ecma specs have all of the formulas defined inside.
Sorry, I can't figure out how to place XML in this directly, so I've removed the tag enclosers, but the tag names/attributes are the same.
dvd
180
Posted by
dvd
on
Wed, Sep 23 2009 4:20 AM
rated by 0 users
Post Points: 20
Re: Preset Shapes
That was it ... I haven't look to all the constant values. Thanks a lot.
Dvd
mjn
20
Posted by
mjn
on
Tue, May 18 2010 10:32 AM
rated by 0 users
Post Points: 20
Re: Preset Shapes
Hi All,
I can see this post is great going..
Can anybody tell me how can I change the angle of a chevron/pentagon by adjusting the value of the yellow node?
I could find the "fmla val" for independent shapes, but not for the SmartArt objects.
Any help is appreciated. many thanks.
Cheers,
mjn
tendoors
555
Posted by
tendoors
on
Tue, May 18 2010 10:51 AM
rated by 0 users
Post Points: 5
Re: Preset Shapes
You can use the same presetShapeDefinition files. SmartArt shapes are the same as regular AutoShapes, except they sit in a different name space:
xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" and xmlns:dsp="http://schemas.microsoft.com/office/drawing/2008/diagram". They "grouped" in a seperate file (usually "drawing1.xml"). You'll get the part you need in a way like this:
Dim dgmDataRelationshp = shp.<graphic>.<a:graphicData>.<dgm:relIds>.@r:dm.ToString
Dim dgmDataPart = pptPackage.GetPart(Packaging.PackUriHelper.ResolvePartUri(ActivePart.Uri, ActivePart.GetRelationship(dgmDataRelationshp).TargetUri))
Dim dgmData = XElement.Load(New StreamReader(dgmDataPart.GetStream))
Dim dspDrawingRelationship = dgmData.<dgm:extLst>.<a:ext>.<dsp:dataModelExt>.@relId
Dim dspDrawingPart = pptPackage.GetPart(Packaging.PackUriHelper.ResolvePartUri(dgmDataPart.Uri, ActivePart.GetRelationship(dspDrawingRelationship).TargetUri))
Dim dspDrawing = XElement.Load(New StreamReader(dspDrawingPart.GetStream))
And then get the shapes like this dspDrawing..Elements and from there (using the "dsp" namespace instead of "a"), you can just query your shapes to get all the values, including the adjustment handle changes. Sorry the text is all munched together, I'm not sure how to format code in this editor.
Page 1 of 1 (12 items)