ListTemplates 对象 (Word)
文档、列表库或模板中的 ListTemplate 对象的集合。
备注
将 ListTemplates 属性与 Document、 ListGallery 或 Template 对象一起使用可返回 ListTemplates 集合。 使用 ListGallery 对象时,ListTemplates 集合是项目符号列表、编号列表和大纲编号列表的七种列表格式。
下面的示例显示活动文档中各列表模板的级别状态 (单级或多级) 的邮件。
For Each lt In ActiveDocument.ListTemplates
MsgBox "This is a multiple-level list template - " _
& lt.OutlineNumbered
Next lt
使用 Add 方法可向指定的文档或模板中的集合添加列表模板。 下面的示例向活动文档添加新的列表模板,并将其应用于所选内容。
Set myLT = ActiveDocument.ListTemplates.Add
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=myLT
使用 ListTemplates (Index) (其中 Index 是列表模板的名称或索引号)可返回文档或模板中的单个列表模板。 以下示例设置一个对象变量,该变量等于活动文档中名为“ListBullets”的列表模板,然后将所选内容的格式设置为该列表模板的第一级。
Set mylt = ActiveDocument.ListTemplates("ListBullets")
Selection.Range.ListFormat.ApplyListTemplateWithLevel ListTemplate:=mylt, ApplyLevel:=1
使用 ListTemplates (Index) (其中 Index 是数字 1 到 7)返回列表库中的单个列表模板。 以下示例设置一个对象变量,该变量等于项目符号列表库中的第一个列表模板,然后将该列表模板应用于所选内容。
Set mylt = ListGalleries(wdBulletGallery).ListTemplates(1)
Selection.Range.ListFormat.ApplyListTemplate ListTemplate:=mylt
注意
某些属性和方法(例如 Convert 和 Add)不适用于列表库中的列表模板。 可以修改这些列表模板,但不能 (wdBulletGallery、 wdNumberGallery 或 wdOutlineNumberGallery) 更改其列表库类型。
若要查看列表库中的列表模板是否包含 Word 中内置的格式,请将 Modified 属性与 ListGallery 对象一起使用。 若要将格式重置为原始列表格式,请使用 ListGallery 对象的 Reset 方法。
返回一个 ListTemplate 对象后,使用 ListLevels (索引),其中索引是从 1 到 9 的数字,返回单个 ListLevel 对象。 ListLevel 对象时,您有权访问指定的列表级别,如 对齐方式 、 字体 、 NumberFormat 、 NumberPosition 、 从 和 TrailingCharacter 格式的所有属性。
使用 转换 方法将多级列表模板转换为单级模板。
另请参阅
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。