locked
Positioning of rotated anchored objects in Word RRS feed

  • Question

  • I'm trying to understand the positioning of anchored, rotated objects in Word.  I've posted three sample files at

    https://sites.google.com/site/ooxmltests/

    The files rot1.docx and rot2.docx each contain a single rectangle, rotated 90 degrees, positioned (horizontally) relative to the margin.  The only substantive difference in the OOXML between the two is in the positioning, which in rot1.docx is

                        <wp:posOffset>
    0
                        </wp:posOffset>

    and in rot2.docx is

                        <wp:align>
    left
                        </wp:align>

    These might be expected to give the same graphical result, but in Word 2013 they do not.  In rot1.docx, Word appears to position the unrotated rectangle as specified, then apply the rotation about the center of the object.  In rot2.docx, Word appears to apply the operations in the other order, positioning the rotated rectangle as specified.  So I could conjecture that wp:posOffset means "position of the unrotated object" and wp:align means "position of the rotated object". 

    However, the third file, catty_anchored.docx, contradicts that.  It positions the image using the wp:align tag (as in rot2.docx) but it seems to use it to specify the position of the unrotated image (as in rot1.docx).

    I haven't found anything in the OOXML spec that describes the proper behavior.  Can you help me understand how Word is determining the positioning of these objects?

    Thanks.

    Kurt

    Thursday, March 27, 2014 12:21 AM

Answers

  • Hi Kurt, the order in which those transforms are being applied is the following.

     

    1. posOffset
    2. Rotation
    3. Alignment
    4. Scaling

     

    The other reason the 3rd file doesn't look like you might expect is because it has scaling applied to the image as well which is processed last.

     

    Please let me know if you have any other questions.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Monday, May 5, 2014 4:17 PM

All replies

  • Hi,

    Thank you for this question. One of our engineers will look into this and follow-up.

    Thanks,

    Edgar

    Thursday, March 27, 2014 3:06 AM
  • Hi Kurt, I am the engineer who will be working with you on this issue. I am currently researching the problem and will provide you with an update soon. Thank you for your patience.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Thursday, March 27, 2014 4:45 PM
  • Hi Kurt, the order in which those transforms are being applied is the following.

     

    1. posOffset
    2. Rotation
    3. Alignment
    4. Scaling

     

    The other reason the 3rd file doesn't look like you might expect is because it has scaling applied to the image as well which is processed last.

     

    Please let me know if you have any other questions.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Monday, May 5, 2014 4:17 PM
  • Josh, thanks for your response.  I'm still a little unclear about the case of the third file, catty_anchored.docx.  Changing the "height" in the Word UI (or in the OOXML) from 1" (914400 emu) to 2" changes the apparent width, but does not change the position of the center of the image.  So assuming the scaling is about the center of the image, and assuming the scale factors still apply to the original, unrotated image, that agrees with the order of operations you show.

    However, changing the "width" from 8" to 4" changes the horizontal position of the image.  This implies that scaling happens before rotation.  Could it be that Word is using different orders of operations for the x and y coordinates?

    Thank you.

    -- Kurt

    Tuesday, May 6, 2014 12:05 AM
  • Hi Kurt, I noticed that as well. The third file also has an effectExtent specified in the XML. Although I don't see that reflected in the UI, so I'm not sure if that was custom modified by hand or not. This effectExtent is also coming into play with the positioning of the image. If I just create a new document with an image that I horizontally align, vertically offset, rotate, and scale, it does not end up having an effectExtent and the positioning of my image is what I would expect.  When I remove the effectExtent from that third file it looks how I would expect. I have not had a chance to investigate the effectExtent fully. Please let me know if you think that is necessary or if the information that we have up to this point is sufficient.

     

    Thank you.


    Josh Curry (jcurry) | Escalation Engineer | Open Specifications Support Team

    Tuesday, May 6, 2014 3:23 PM
  • Josh, thanks for following up.  Yes, I think this is pretty well cleared up for me now.  I appreciate your assistance.

    -- Kurt

    Tuesday, May 6, 2014 10:07 PM