Textbox sizing in word and open xml don't appear to match

Connor Shore 186 Reputation points
2022-08-26T21:03:59.493+00:00

Hello, I have a question about the text box positioning and its correlation to the openxml for the textbox.

This template consist of a textbox within a group shape. When I click on the outer group shape and inspect its sizing, we can see that its absolutely sized to about 1/2 inch by 1/2 inch: 235371-image.png

When you look at the open xml, the extent is roughly 450,000 emus which is correct: 235372-image.png

However, when you inspect the textbox's sizing properties, you will notice its absolutely sized just slightly smaller than the group shape: 235381-image.png

When you inspect the open xml for the textbox, it is only about 500 emus for width and height which is drastically smaller than what's defined in the word dialog. There is an attribute in the openxml for the textbox "spAutoFit", however when you edit the textbox in word, you will notice it doesn't automatically size with the text. If you type additional "!" in the textbox, it will begin to wrap around showing that the textbox does indeed have a fixed width.

My question is why is there such a big difference between the openxml and the word dialog for the textbox size?

Here is a link to a folder that contains the docx file along with it's document.xml: https://windwardstudios.box.com/s/9msvsvkic5m68xumubjynird1482744s

Office Open Specifications
Office Open Specifications
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Open Specifications: Technical documents for protocols, computer languages, standards support, and data portability. The goal with Open Specifications is to help developers open new opportunities to interoperate with Windows, SQL, Office, and SharePoint.
127 questions
{count} vote

2 answers

Sort by: Most helpful
  1. Hung-Chun Yu 976 Reputation points Microsoft Employee
    2022-08-31T01:56:30.59+00:00

    Hi @Connor Shore

    Here is what I found out - Ultimately what is going on is that the text box is resizing to fit the text and also wrapping the text inside the shape:

    236347-image.png

    Let me know if this answers your question.

    Hung-Chun Yu
    Microsoft Open Specifications Support

    1 person found this answer helpful.
    0 comments No comments

  2. Connor Shore 186 Reputation points
    2022-08-31T15:20:08.957+00:00

    Hi @Hung-Chun Yu , that make sense thank you! Do you also happen to know which WordML property the "Wrap text in shape" checkbox maps to? Is it the wrap property here or is it something else?:

    <wps:bodyPr rot="0" vert="horz" wrap="square" lIns="0" tIns="0" rIns="0" bIns="0" anchor="t" anchorCtr="0" upright="1">  
       <a:spAutoFit/>  
    </wps:bodyPr>  
    
    1 person found this answer helpful.