Asked by:
Calculating final positions of rotated grouped elements in a PPTX XML
Question

Hi,
We need to determine the position of images in PPTX files. We figured most of the things out (a:off, a:chOff, a:chOff and a:chExt are clear). If we have a document with all kinds of grouping in there, this works out nicely, and we can determine the exact position of each contained "pic" object.
However, we get into trouble when there is rotation involved (not the math to rotate a point around a center, that is checked and double checked). If only a single picnode is rotated, it is easy, and we end up with the correct position and angle. However, when we start rotating groups, we have trouble to determine the correct positions.
Is there a technical guide somewhere, or a good example, describing the order in which we need to calculate the points, and which point we need to consider? Do we need to work from the top to the bottom (group1 > group2 > pic) or bottom to top (pic > group2 > group1)? Do we flatten everything, how does the rotation work with the ungrouping/flattening?
My example is simple: a slide with 4 times the same image in it (to make it simple, each image 200x100 in size, lined up in a square of 400x200, top left, top right, bottom left and bottom right). Rotate the "bottomright" image 45 degrees, group it with the bottomleft image. Group the two top images as well, and finally group both groups together. Then, rotate the final group also 45 degrees (which makes the rotated image 90 degrees rotated, and the other three 45 degrees).
I cannot find the correct order in which to work my way through the XML tree and in which order I need to apply the rotation. Any help here would be appreciated (a good explanation, links to docs or even a piece of (pseudo)code).
All replies


Hello Bernard:
I'll assist you with this inquiry.
Can you please drop me an email to dochelp at Microsoft.com so that I can share a link to upload your sample PPTX file to ensure we both are looking at the same file for position calculation?
Thanks.
Tarun Chopra  Escalation Engineer  Open Specifications Support Team

Hey Bernard,
I appears that the conversation here was discontinued and we're assuming you found some solution. If not, and you have a specific question about where your implementation is stalled, provide us with a specific question related to our documentation and we'll take another look.
Best regards,
Tom Jebo
Sr Escalation Engineer
Microsoft Open Specifications
 Proposed as answer by Edgar A OlougounaMicrosoft employee, Moderator Sunday, February 17, 2019 7:00 PM