返回一个
DocumentProperties 集合,该集合代表指定文档的所有内置的文档属性。
语法
表达式.BuiltInDocumentProperties
表达式 必选。一个代表 Document 对象的变量。
说明
要返回单个代表特定内置文档属性的 DocumentProperty 对象,可使用 BuiltinDocumentProperties 属性。如果 WPS
没有为一个内置的文档属性定义一个值,则读取这个文档属性的 Value 属性时会产生一个错误。
有关返回集合中单个成员的信息,请参阅 返回集合中的对象。
用 CustomDocumentProperties 属性返回自定义文档属性的集合。
示例
本示例在活动文档的末尾插入一个内置属性列表。
示例代码 |
function ListProperties() {
let rngDoc = ActiveDocument.Content
rngDoc.Collapse(wdCollapseEnd)
let proDoc = ActiveDocument.BuiltInDocumentProperties
for(let i=1;i <= proDoc.Count;i++) {
try {
rngDoc.InsertParagraphAfter()
rngDoc.InsertAfter(proDoc.Item(i).Name + "= ")
}
catch(exception) {
rngDoc.InsertAfter(proDoc.Item(i).Value)
}
}
}
|
本示例显示活动文档中的单词数。
示例代码 |
function DisplayTotalWords() {
let intWords = ActiveDocument.BuiltInDocumentProperties.Item(wdPropertyWords).Value
MsgBox("This document contains " + intWords + " words.")
}
|