返回一个
String 类型的值,该值代表不带任何前缀的元素名称。
语法
表达式.BaseName
表达式 必选。一个代表 XMLNode 对象的变量。
示例
下例将 author 属性添加到活动文档中的 book 元素,然后设置属性的值。
示例代码 |
function AddIDAttribute(){
let objElement = ActiveDocument.XMLNodes
for(let i = 1; i <= objElement.Count; i++){
if(objElement.Item(i).NodeType == wdXMLNodeElement){
if(objElement.Item(i).BaseName == "book"){
let objAttribute = objElement.Item(i).Attributes.Add("author", objElement.NamespaceURI)
objAttribute.NodeValue = "David Barber"
}
}
}
}
|