WPS 基础接口 > 文字 API 参考 > Document > 属性 > Document.Lists 属性
返回一个 Lists 集合,该集合含有指定文档中的所有项目符号和编号列表。只读。

语法

表达式.Lists

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

说明

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

示例

本示例设置所选内容的格式为编号列表,然后在一个消息框中显示活动文档中列表数。

示例代码
Selection.Range.ListFormat.ApplyListTemplate(ListGalleries.Item(wdNumberGallery).ListTemplates.Item(2))
MsgBox("This document has " + ActiveDocument.Lists.Count + " lists.")

本示例设置活动文档中第三个列表的格式为默认的项目符号列表格式。如果该列表已设置为项目符号列表格式,该示例清除此格式。

示例代码
if(ActiveDocument.Lists.Count >= 3) {
    ActiveDocument.Lists.Item(3).Range.ListFormat.ApplyBulletDefault()
}

本示例在一个消息框中显示 MyLetter.doc 的每一列表的项目数。

示例代码
let myDoc = Documents.Item("MyLetter.doc")
let i = myDoc.Lists.Count
for(let j = 1; j <= i; j++) {
    MsgBox("List " + i + " has " + myDoc.Lists.Item(j).CountNumberedItems() + " items.")
    i = i - 1
}


请参阅