Table of contents

Shapes.AddTextbox 方法 (发布服务器)Shapes.AddTextbox Method (Publisher)

office 365 dev account|上次更新日期: 2018/3/13
3 参与人员

将添加到指定的Shapes集合表示文本框中新的Shape对象。Adds a new Shape object representing a text box to the specified Shapes collection.


表达式AddTextbox方向左侧顶部宽度高度expression. AddTextbox( Orientation, Left, Top, Width, Height)

表示形状对象的 _expression_A 变量。_expression_A variable that represents a Shapes object.


名称Name必需/可选Required/Optional数据类型Data Type说明Description
方向Orientation必需RequiredPbTextOrientationPbTextOrientation文本框的方向。The orientation of the text box.
向左Left必需RequiredVariantVariant代表文本框的形状的左边缘的位置。The position of the left edge of the shape representing the text box.
页首Top必需RequiredVariantVariant代表文本框的形状的上边缘的位置。The position of the top edge of the shape representing the text box.
WidthWidth必需RequiredVariantVariant代表文本框的形状的宽度。The width of the shape representing the text box.
HeightHeight必需RequiredVariantVariant代表文本框的形状的高度。The height of the shape representing the text box.

返回值Return Value



左侧、 顶部、 宽度和高度参数的数值计算,以磅为单位。字符串可以是在 Microsoft 发布服务器 (例如,读) 所支持的任何单位。For the Left, Top, Width, and Height parameters numeric values are evaluated in points; strings can be in any units supported by Microsoft Publisher (for example, "2.5 in").

方向参数可以是在 Microsoft 发布服务器类型库中声明,如下表所示的PbTextOrientation常量之一。The Orientation parameter can be one of the PbTextOrientation constants declared in the Microsoft Publisher type library and shown in the following table.

pbTextOrientationHorizontalpbTextOrientationHorizontal用于从左向右书写的语言的水平文本框。A horizontal text box for left-to-right languages.
pbTextOrientationRightToLeftpbTextOrientationRightToLeft用于从右向左书写的语言的水平文本框。如果未选定从右向左书写的语言,则该值无效。A horizontal text box for right-to-left languages. This value has no effect if a right-to-left language is not selected.
pbTextOrientationVerticalEastAsiapbTextOrientationVerticalEastAsia用于东亚语言的垂直文本框。如果选定非东亚语言,文本将显示为向右旋转 90 度。A vertical text box for East Asian languages. If a non-East Asian language is selected, text appears rotated 90 degrees to the right.


以下示例将一个新的水平文本框添加到当前出版物的第一页。The following example adds a new horizontal text box to the first page of the active publication.

Dim shpTextBox As Shape 

Set shpTextBox = ActiveDocument.Pages(1).Shapes.AddTextBox _ 
 (Orientation:=pbTextOrientationHorizontal, _ 
 Left:=144, Top:=144, _ 
 Width:=72, Height:=18) 
© 2018 Microsoft