多种对象![]() ![]() ![]() |
List 对象的集合,该集合表示指定文档中的所有列表。
用 Lists 属性可返回 Lists 集合。下列示例显示活动文档各列表的项数。
For Each li In ActiveDocument.Lists
MsgBox li.CountNumberedItems
Next li
用 Lists (index) 可返回单个的 List 对象,其中 index 是索引序号。下列示例将“项目符号和编号”对话框中“编号”选项卡上的第一种列表格式应用于活动文档中的第二个列表。
Set temp1 = ListGalleries(wdNumberGallery).ListTemplates(1)
ActiveDocument.Lists(2).ApplyListTemplate ListTemplate:=temp1
如果用 For Each...Next 循环来列举 Lists 集合,则可逆序返回文档中的列表。下列示例从文档底部开始向上统计活动文档各列表中的项数。
For Each li In ActiveDocument.Lists
MsgBox li.CountNumberedItems
Next li
要在文档中添加列表,可对指定区域的 ListFormat 对象使用 ApplyListTemplate 方法。
可在文档中控制单个的 List 对象,但如果要精确地控制,则需用 ListFormat 对象。
图片项目符号列表不包含在 Lists 集合中。