WPS 基础接口 > 文字 API 参考 > Document > 属性 > Document.CustomDocumentProperties 属性
返回一个 DocumentProperties 集合,该集合代表指定文档的所有自定义文档属性。

语法

表达式.CustomDocumentProperties

表达式   必选。一个代表 Document 对象的变量。

说明

使用 BuiltInDocumentProperties 属性可返回内置文档属性的集合。

msoPropertyTypeString 类型的属性的长度不能超过 255 个字符。

有关返回集合中单个成员的信息,请参阅 返回集合中的对象。

示例

本示例在活动文档的末尾插入一个自定义内置属性列表。

示例代码
let myRange = ActiveDocument.Content
myRange.Collapse(wdCollapseEnd)									
let prop = ActiveDocument.CustomDocumentProperties
for(let i=1;i <= prop.Count;i++) {
    myRange.InsertParagraphAfter()
    myRange.InsertAfter(prop.Item(i).Name + "= ")
    myRange.InsertAfter(prop.Item(i).Value)
}

本示例为 Sales.doc 添加一个自定义内置属性。

示例代码
let thename = prompt("Please type your name", "Name")
Documents.Item("Sales.doc").CustomDocumentProperties.Add("YourName", false, msoPropertyTypeString, thename)


请参阅