ParagraphFormat. SetListType, méthode (Publisher)ParagraphFormat.SetListType method (Publisher)
Définit le type de liste de l'objet ParagraphFormat spécifié.Sets the list type of the specified ParagraphFormat object.
SyntaxeSyntax
expression. SetListType (Valeur, BulletText)expression.SetListType (Value, BulletText)
expression Variable qui représente un objet ParagraphFormat .expression A variable that represents a ParagraphFormat object.
ParamètresParameters
NomName | Requis/FacultatifRequired/Optional | Type de donnéesData type | DescriptionDescription |
---|---|---|---|
ValueValue | RequisRequired | PbListTypePbListType | Représente le type de liste de l'objet ParagraphFormat spécifié.Represents the list type of the specified ParagraphFormat object. Il peut s’agir de l’une des constantes PbListType déclarées dans la bibliothèque de type Microsoft Publisher.Can be one of the PbListType constants declared in the Microsoft Publisher type library. |
BulletTextBulletText | FacultatifOptional | ChaîneString | Chaîne qui représente le texte de la puce de liste.A string that represents the text of the list bullet. |
RemarquesRemarks
Si la valeur est une liste à puces et que le paramètre BulletText est manquant, la première puce de la boîte de dialogue puces et numéros est utilisée.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 est limité à un caractère.BulletText is limited to one character.
Une erreur d’exécution se produit si le paramètre BulletText est fourni et le paramètre value n’est pas défini sur pbListTypeBullet.A run-time error occurs if the BulletText parameter is provided and the Value parameter is not set to pbListTypeBullet.
ExempleExample
Cet exemple vérifie si le type de liste est une liste numérotée, en particulier la valeur pbListTypeArabic.This example tests to see if the list type is a numbered list, specifically pbListTypeArabic. Si la propriété ListType est définie sur valeur pbListTypeArabic, la propriété ListNumberSeparator est définie sur valeur pbListSeparatorParenthesis.If the ListType property is set to pbListTypeArabic, the ListNumberSeparator property is set to pbListSeparatorParenthesis. Dans le cas contraire, la méthode SetListType est appelée et transmet valeur pbListTypeArabic en tant que paramètre value , puis la propriété ListNumberSeparator peut être définie.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
Cet exemple illustre la configuration d'une structure de document contenant des cadres de texte nommée avec des listes.This example demonstrates how an organized document structure containing named text frames with lists can be configured. Cet exemple suppose que la composition comporte une convention d’affectation de noms pour les objets TextFrame contenant des listes qui utilisent le mot «List» comme préfixe.This example assumes that the publication has a naming convention for TextFrame objects containing lists that use the word "list" as a prefix. Cet exemple utilise des itérations de collection imbriquées pour accéder à chaque objet TextFrame de chaque collection Shapes de chaque Page.This example uses nested collection iterations to access each of the TextFrame objects in each Shapes collection of each Page. L’objet ParagraphFormat de chaque nom TextFrame avec le préfixe «list» a les propriétés ListType et ListBulletFontSize définies.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
Assistance et commentairesSupport and feedback
Avez-vous des questions ou des commentaires sur Office VBA ou sur cette documentation ?Have questions or feedback about Office VBA or this documentation? Consultez la rubrique concernant l’assistance pour Office VBA et l’envoi de commentaires afin d’obtenir des instructions pour recevoir une assistance et envoyer vos commentaires.Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.