LinkToListTemplate 方法

       

将指定的样式与一个列表模板链接,如此该样式中的格式就可以应用于列表。

expression.LinkToListTemplate(ListTemplate, ListLevelNumber)

expression   必需。该表达式返回一个 Style 对象。

ListTemplate   ListTemplate 对象,必需。与样式相链接的列表模板。

ListLevelNumber   Variant 类型,可选。与列表级别相对应的整数,该列表级别将与样式建立链接。如果省略这个参数,则使用样式的级别。

示例

本示例创建一个新的列表模板,接着将 1 到 9 的标题样式与 1 到 9 的列表级别相链接。然后将新列表模板应用于文档。任何应用标题样式的段落都根据列表模板进行编号。

Dim ltTemp As ListTemplate
Dim intLoop As Integer

Set ltTemp = _
    ActiveDocument.ListTemplates.Add(OutlineNumbered:=True)

For intLoop = 1 To 9
    With ltTemp.ListLevels(intLoop)
        .NumberStyle = wdListNumberStyleArabic
        .NumberPosition = InchesToPoints(0.25 * (intLoop - 1))
        .TextPosition = InchesToPoints(0.25 * intLoop)
        .NumberFormat = "%" & intLoop & "."
    End With
    With ActiveDocument.Styles("Heading " & intLoop)
       .LinkToListTemplate ListTemplate:=ltTemp
    End With
Next intLoop

ActiveDocument.Content.ListFormat.ApplyListTemplate _
    ListTemplate:=ltTemp