ShapeRange - setting the horz/vert alignment?

C

Colbert Zhou [MSFT]

Hello Dave,

ShapeRange in Word Object Model means a set of shapes on a document. So do
you mean set a Shape's vertical and horizontal alignment? If that is the
case,
we can set it via Shape.Left and Shape.Top to the following enumerations,

wdShapeBottom At the bottom.
wdShapeCenter In the center.
wdShapeInside Inside the selected range.
wdShapeLeft On the left.
wdShapeOutside Outside the selected range.
wdShapeRight On the right.
wdShapeTop At the top.

We can also set Shape.RelativeHorizontalPosition and
RelativeVerticalPosition to specify the what the Left and Top properties
are relative to. It can be the following enumerations,
wdRelativeHorizontalPositionCharacter 3 Relative to character.
wdRelativeHorizontalPositionColumn 2 Relative to column.
wdRelativeHorizontalPositionMargin 0 Relative to margin.
wdRelativeHorizontalPositionPage 1 Relative to page.
wdRelativeHorizontalPositionInnerMarginArea 6 Relative to inner margin
area.
wdRelativeHorizontalPositionLeftMarginArea 4 Relative to left margin.
wdRelativeHorizontalPositionOuterMarginArea 7 Relative to outer margin
area.
wdRelativeHorizontalPositionRightMarginArea 5 Relative to right margin.

For examples, the following codes set it a shape to top center of the page,

Sub Test()
ThisDocument.Shapes(1).RelativeHorizontalPosition =
wdRelativeHorizontalPositionPage
ThisDocument.Shapes(1).RelativeVerticalPosition =
wdRelativeVerticalPositionPage
ThisDocument.Shapes(1).Left = wdShapeCenter
ThisDocument.Shapes(1).Top = wdShapeTop
End Sub

If you have any future questions or concerns on this, just let me know. :)
Have a nice day, Sir!

Best regards,
Ji Zhou
Microsoft Online Community Support
 
D

David Thielen

Left and Top are floats used for offsets from the relative position. I
also can't find wdShapeLeft, etc anywhere in the PIAs or the
documentation.

??? - thanks - dave



Hello Dave,

ShapeRange in Word Object Model means a set of shapes on a document. So do
you mean set a Shape's vertical and horizontal alignment? If that is the
case,
we can set it via Shape.Left and Shape.Top to the following enumerations,

wdShapeBottom At the bottom.
wdShapeCenter In the center.
wdShapeInside Inside the selected range.
wdShapeLeft On the left.
wdShapeOutside Outside the selected range.
wdShapeRight On the right.
wdShapeTop At the top.

We can also set Shape.RelativeHorizontalPosition and
RelativeVerticalPosition to specify the what the Left and Top properties
are relative to. It can be the following enumerations,
wdRelativeHorizontalPositionCharacter 3 Relative to character.
wdRelativeHorizontalPositionColumn 2 Relative to column.
wdRelativeHorizontalPositionMargin 0 Relative to margin.
wdRelativeHorizontalPositionPage 1 Relative to page.
wdRelativeHorizontalPositionInnerMarginArea 6 Relative to inner margin
area.
wdRelativeHorizontalPositionLeftMarginArea 4 Relative to left margin.
wdRelativeHorizontalPositionOuterMarginArea 7 Relative to outer margin
area.
wdRelativeHorizontalPositionRightMarginArea 5 Relative to right margin.

For examples, the following codes set it a shape to top center of the page,

Sub Test()
ThisDocument.Shapes(1).RelativeHorizontalPosition =
wdRelativeHorizontalPositionPage
ThisDocument.Shapes(1).RelativeVerticalPosition =
wdRelativeVerticalPositionPage
ThisDocument.Shapes(1).Left = wdShapeCenter
ThisDocument.Shapes(1).Top = wdShapeTop
End Sub

If you have any future questions or concerns on this, just let me know. :)
Have a nice day, Sir!

Best regards,
Ji Zhou
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 
C

Colbert Zhou [MSFT]

Hello Dave,

wdShapeBottom, wdShapeCenter, wdShapeInside, wdShapeLeft, wdShapeOutSide,
wdShapeRight, wdShapeTop are enumerations under
Microsoft.Office.Interop.Word.WdShapePosition.

The online document is here,
http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.wdshap
eposition(office.11).aspx

wdShapeBottom, wdShapeTop, wdShapeCenter can be set to Top property.
wdShapeLeft, wdShapeRight, wdShapeCenter can be set to Left property.

We can assign them to Left and Top because all of them are special values,
-999997 Bottom
-999995 Center
-999994 Inside
-999998 Left
-999993 Outside
-999996 Right
-999999 Top

Word knows how to align the Shape object if the Left or Top property set to
these kinds of values. :)


Best regards,
Ji Zhou
Microsoft Online Community Support
 
D

David Thielen

Thank you. Interesting way to minimize the API.

thanks - dave


Hello Dave,

wdShapeBottom, wdShapeCenter, wdShapeInside, wdShapeLeft, wdShapeOutSide,
wdShapeRight, wdShapeTop are enumerations under
Microsoft.Office.Interop.Word.WdShapePosition.

The online document is here,
http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.wdshap
eposition(office.11).aspx

wdShapeBottom, wdShapeTop, wdShapeCenter can be set to Top property.
wdShapeLeft, wdShapeRight, wdShapeCenter can be set to Left property.

We can assign them to Left and Top because all of them are special values,
-999997 Bottom
-999995 Center
-999994 Inside
-999998 Left
-999993 Outside
-999996 Right
-999999 Top

Word knows how to align the Shape object if the Left or Top property set to
these kinds of values. :)


Best regards,
Ji Zhou
Microsoft Online Community Support


david@[email protected]
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top