I am attempting to resize and reposition an existing fixed positioned
text box however I’m having difficulties with:
- 1.
Determining vertical position (for example, top
or bottom)
- 2.
Changing the text box position
Background
I have textboxes that have fixed position and have vertical
alignment set to either top or bottom. During an image mail merge, I find the
owning textbox for the mail merge field and then resize and reposition the text
box based on the image size.
1. Vertical Alignment
How do I determine the text box vertical alignment as seen
through the Format Shape dialog in Microsoft
Word?
For example, the attached file contains image of document layout wherePHOTO_PATH2
merge field is within a text box that has its vertical alignment set to Bottom.
Through the non-public Shape property, I see the
TextVerticalAlignment property is set as I expect:
textBox.TextBoxFormat.TextVerticalAlignment
== VerticalAlignment.Bottom
However, I expected to use textBox.TextBoxFormat.VerticalAlignment
property however it is always ‘None’:
textBox.TextBoxFormat.VerticalAlignment
== ShapeVerticalAlignment.None
2. TextBox Position
When adjusting the position of the text box, I expected to
use the properties
textBox.TextBoxFormat.HorizontalPosition
textBox.TextBoxFormat.VerticalPosition
I found that these properties are saved however they are not
reflected in the document when opened with Microsoft Word.
It appears that using the non-public Shape property does work as expected however it is not public:
textBox.Shape.HorizontalPosition
textBox.Shape.VerticalPosition
Attachment: DocumentLayout_b19494af.zip