ParagraphFormat.SetListType 方法 (Publisher)

设置指定的 ParagraphFormat 对象的列表类型。

语法

表达式SetListType (ValueBulletText)

表达 一个代表 ParagraphFormat 对象的变量。

参数

名称 必需/可选 数据类型 说明
必需 PbListType 表示指定的 ParagraphFormat 对象的列表类型。 可以是 Microsoft Publisher 类型库中声明的 PbListType 常量之一。
BulletText 可选 字符串 一个表示列表项目符号文本的字符串。

备注

如果 Value 是项目符号列表,并且缺少 BulletText 参数,则使用“ 项目符号和编号 ”对话框中的第一个项目符号。

BulletText 限制为一个字符。

如果提供了 BulletText 参数,并且 Value 参数未设置为 pbListTypeBullet,则会发生运行时错误。

示例

此示例测试列表类型为编号的列表,特别是 pbListTypeArabic 。 如果 ListType 属性设置为 pbListTypeArabic,则 ListNumberSeparator 属性设置为 pbListSeparatorParenthesis。 否则,将调用 SetListType 方法,并将 pbListTypeArabic 作为 Value 参数传递,然后可以设置 ListNumberSeparator 属性。

Dim objParaForm As ParagraphFormat 
 
Set objParaForm = ActiveDocument.Pages(1).Shapes(1).TextFrame.TextRange.ParagraphFormat 
 
With objParaForm 
 If .ListType = pbListTypeArabic Then 
 .ListNumberSeparator = pbListSeparatorParenthesis 
 Else 
 .SetListType pbListTypeArabic 
 .ListNumberSeparator = pbListSeparatorParenthesis 
 End If 
End With 
 

此示例演示如何配置包含列表命名的文本框架组织的文档结构。 此示例假定发布具有 TextFrame 对象的命名约定,该对象包含使用单词“list”作为前缀的列表。 此示例使用嵌套的集合迭代访问每个 TextFrame 对象的每一 页上 每个 形状 集合中。 前缀为“list”的每个 TextFrame 名称的 ParagraphFormat 对象具有 ListTypeListBulletFontSize 属性集。

Dim objPage As page 
Dim objShp As Shape 
Dim objTxtFrm As TextFrame 
 
'Iterate through all pages of th ePublication 
For Each objPage In ActiveDocument.Pages 
 'Iterate through the Shapes collection of objPage 
 For Each objShp In objPage.Shapes 
 'Find each TextFrame object 
 If objShp.Type = pbTextFrame Then 
 'If the name of the TextFrame begins with "list" 
 If InStr(1, objShp.Name, "list") <> 0 Then 
 Set objTxtFrm = objShp.TextFrame 
 With objTxtFrm 
 With .TextRange 
 With .ParagraphFormat 
 .SetListType pbListTypeBullet, "*" 
 .ListBulletFontSize = 24 
 End With 
 End With 
 End With 
 End If 
 End If 
 Next 
Next 
 

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。