返回一个
DiagramNode 对象,该对象代表父节点的第一个子节点。只读。
语法
表达式.FirstChild
表达式 必选。一个代表 XMLNode 对象的变量。
说明
使用 LastChild 属性访问最后一个子节点。使用 Root 属性访问图表中的父节点。
示例
本示例将一个组织图表添加至活动文档,添加三个节点,并将第一个和最后一个子节点赋给变量。
示例代码 |
function FirstChild() {
let shpDiagram
let dgnRoot
let dgnFirstChild
let dgnLastChild
let intCount
//Add organizational chart diagram to the current document
shpDiagram = ActiveDocument.Shapes.AddDiagram(msoDiagramOrgChart, 10, 15, 400, 475)
//Add the first node to the diagram
dgnRoot = shpDiagram.DiagramNode.Children.AddNode()
//Add three child nodes
for(intCount = 1; intCount <= 3; intCount++) {
dgnRoot.Children.AddNode()
}
//Assign the first and last child nodes to variables
dgnFirstChild = dgnRoot.Children.FirstChild
dgnLastChild = dgnRoot.Children.LastChild
}
|