ParagraphFormat 方法 (Publisher)ParagraphFormat.SetListType method (Publisher)

设置指定的ParagraphFormat对象的列表类型。Sets the list type of the specified ParagraphFormat object.

语法Syntax

表达式SetListType(Value, BulletText)expression.SetListType (Value, BulletText)

_表达式_一个代表**ParagraphFormat** 对象的变量。expression A variable that represents a ParagraphFormat object.

参数Parameters

名称Name 必需/可选Required/Optional 数据类型Data type 说明Description
ValueValue 必需Required PbListTypePbListType 表示指定的 ParagraphFormat 对象的列表类型。Represents the list type of the specified ParagraphFormat object. 可以是在 Microsoft 发布服务器类型库中声明的PbListType常量之一。Can be one of the PbListType constants declared in the Microsoft Publisher type library.
BulletTextBulletText 可选Optional 字符串String 一个字符串, 表示列表项目符号的文本。A string that represents the text of the list bullet.

说明Remarks

如果_Value_是项目符号列表, 并且缺少_BulletText_参数, 则使用 "项目符号和编号" 对话框中的第一个项目符号。If Value is a bulleted list and the BulletText parameter is missing, the first bullet from the Bullets and Numbering dialog box is used.

_BulletText_限制为一个字符。BulletText is limited to one character.

如果提供了_BulletText_参数, 而_Value_参数未设置为pbListTypeBullet, 则会发生运行时错误。A run-time error occurs if the BulletText parameter is provided and the Value parameter is not set to pbListTypeBullet.

示例Example

此示例测试列表类型为编号的列表,特别是 pbListTypeArabicThis example tests to see if the list type is a numbered list, specifically pbListTypeArabic. 如果将**ListType** 属性设置为PbListTypeArabic, 则**ListNumberSeparator** 属性设置为pbListSeparatorParenthesisIf the ListType property is set to pbListTypeArabic, the ListNumberSeparator property is set to pbListSeparatorParenthesis. 否则, 将调用SetListType方法并将pbListTypeArabic作为_Value_参数传递, 然后可以设置ListNumberSeparator属性。Otherwise, the SetListType method is called and passes pbListTypeArabic as the Value parameter, and then the ListNumberSeparator property can be set.

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 
 

此示例演示如何配置包含列表命名的文本框架组织的文档结构。This example demonstrates how an organized document structure containing named text frames with lists can be configured. 本示例假定出版物具有**TextFrame** 对象的命名约定, 这些对象包含使用 "list" 一词作为前缀的列表。This example assumes that the publication has a naming convention for TextFrame objects containing lists that use the word "list" as a prefix. 此示例使用嵌套的集合迭代访问每个 TextFrame 对象的每一 页上 每个 形状 集合中。This example uses nested collection iterations to access each of the TextFrame objects in each Shapes collection of each Page. 具有前缀 "list" 的每个TextFrame名称的ParagraphFormat对象具有设置的ListTypeListBulletFontSize属性。The ParagraphFormat object of each TextFrame name with the prefix "list" has the ListType and ListBulletFontSize properties set.

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 
 

支持和反馈Support and feedback

有关于 Office VBA 或本文档的疑问或反馈?Have questions or feedback about Office VBA or this documentation? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.