Table of contents
TOC
折叠目录
展开目录

Shape.TextFrame2 属性 (项目)Shape.TextFrame2 Property (Project)

office 365 dev account|上次更新日期: 2017/9/25
|
1 参与者

获取一个TextFrame2对象,该对象包含文本框中的文本框架和控件的对齐方式、 锚定,和其他功能的文本框架的成员。只读的TextFrame2Gets a TextFrame2 object that contains the text in a text frame and the members that control the alignment, anchoring, and other features of the text frame. Read-only TextFrame2.

语法Syntax

表达式TextFrame2expression. TextFrame2

表达式_一个表示一个Shape对象的变量。_expression A variable that represents a Shape object.

注解Remarks

TextFrame2对象包含许多相同的属性为一个TextFrame对象,再加上其他属性自动调整ThreeDWordArtformat等。A TextFrame2 object contains many of the same properties as a TextFrame object, plus additional properties such as AutoSize, ThreeD, and WordArtformat.

示例Example

下面的示例创建两个文本框,并将它们添加到一个ShapeRange对象、 设置这两个文本框架中自动调整文本、 设置文本的前景色中第一个文本框的形状到红色,集到形状区域的前景色偏黄纸茶色,然后使用TextEffect属性来设置形状范围中的两个文本框的字体属性。The following example creates two text boxes and adds them to a ShapeRange object, sets both text frames to automatically fit the text, sets the foreground color of text in the first text box shape to red, sets the foreground color of the shape range to a yellowish tan, and then uses the TextEffect property to set font properties on both text boxes in the shape range.

TextFrame2属性的单个Shape对象中以粗体字显示。The TextFrame2 property for the individual Shape objects are shown in bold font.

Sub FormatTextBox()
    Dim theReport As Report
    Dim textShape1 As shape
    Dim textShape2 As shape
    Dim reportName As String
    Dim sRange As ShapeRange

    reportName = "Textbox range report"

    Set theReport = ActiveProject.Reports.Add(reportName)
    Set textShape1 = theReport.Shapes.AddTextbox(msoTextOrientationHorizontal, 30, 50, 350, 80)
    textShape1.Name = "Text box 1"

    Set textShape2 = theReport.Shapes.AddTextbox(msoTextOrientationHorizontal, 30, 130, 350, 80)
    textShape2.Name = "Text box 2"

    Set sRange = theReport.Shapes.Range(Array("Text box 1", "Text box 2"))

    sRange.TextFrame2.AutoSize = msoAutoSizeShapeToFitText

    sRange(1).TextFrame2.TextRange.Text = "This is a test. It is only a test."
    sRange(2).TextFrame2.TextRange.Text = "This is text box 2."
    sRange(1).TextFrame2.TextRange.Characters.Font.Fill.ForeColor.RGB = &;H2020CC
    sRange.Fill.ForeColor.RGB = &;H88CCCC

    With sRange.TextEffect
        .FontName = "Courier New"
        .FontBold = True
        .FontItalic = True
        .FontSize = 28
    End With

    sRange(2).Select
End Sub

属性值Property value

TEXTFRAME2TEXTFRAME2

另请参阅See also

其他资源Other resources

形状对象TextFrame2Shape ObjectTextFrame2

© 2018 Microsoft