TextShape 属性

       

返回一个 Shape 对象,它表示带有图表节点的文本框形状。

expression.TextShape

expression   必需。该表达式返回一个 DiagramNode 对象。

示例

本示例在父节点中添加子节点,并在父节点中显示文本以代表创建的子节点数目。

Sub CountChildNodes()
    Dim shpDiagram As Shape
    Dim dgnNode As DiagramNode
    Dim shpText As Shape
    Dim intCount As Integer

    'Add radial diagram to the current document
    Set shpDiagram = ThisDocument.Shapes.AddDiagram _
        (Type:=msoDiagramRadial, Left:=10, _
        Top:=15, Width:=400, Height:=475)

    'Add first node to the diagram
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Add three child nodes
    For intCount = 1 To 3
        dgnNode.Children.AddNode
    Next intCount

    'Add a text box for each node in the diagram
    For intCount = 1 To 4
        Set shpText = shpDiagram.DiagramNode.Children(1).TextShape
        shpText.TextFrame.TextRange.Text = Str(intCount)
    Next intCount
End Sub