Share via


DocumentBase.StyleSortMethod Propriété

Définition

Obtient ou définit une valeur qui spécifie la méthode de tri à utiliser lors du tri des styles dans le volet Office Styles.

public:
 property Microsoft::Office::Interop::Word::WdStyleSort StyleSortMethod { Microsoft::Office::Interop::Word::WdStyleSort get(); void set(Microsoft::Office::Interop::Word::WdStyleSort value); };
public Microsoft.Office.Interop.Word.WdStyleSort StyleSortMethod { get; set; }
member this.StyleSortMethod : Microsoft.Office.Interop.Word.WdStyleSort with get, set
Public Property StyleSortMethod As WdStyleSort

Valeur de propriété

Une des valeurs de l'objet WdStyleSort.

Exemples

L’exemple de code suivant affiche la méthode de tri actuelle pour le volet Office Styles . Ensuite, si la méthode de tri actuelle n’est pas la méthode de tri alphabétique, le code affiche un message qui informe l’utilisateur que la méthode de tri est sur le point d’être modifiée, puis modifie la méthode de tri dans l’ordre alphabétique. Pour utiliser cet exemple, exécutez-le à partir de la ThisDocument classe dans un projet au niveau du document.

private void SetStyleSortOrder()
{
    MessageBox.Show("Current sort method for the styles task pane is: " 
        + this.StyleSortMethod.ToString());
    if (this.StyleSortMethod != Word.WdStyleSort.wdStyleSortByName)
    {
        MessageBox.Show("Changing sort method to "
            + Word.WdStyleSort.wdStyleSortByName.ToString()
            + " to sort styles alphabetically in the styles "
            + "task pane.");
        this.StyleSortMethod = Word.WdStyleSort.wdStyleSortByName;
    }            
}
Private Sub SetStyleSortOrder()
    MessageBox.Show("Current sort method for the styles task pane is: " _
            + Me.StyleSortMethod.ToString())
    If Me.StyleSortMethod <> Word.WdStyleSort.wdStyleSortByName Then
        MessageBox.Show("Changing sort method to " _
            + Word.WdStyleSort.wdStyleSortByName.ToString() _
            + " to sort styles alphabetically in the styles " _
            + "task pane.")
        Me.StyleSortMethod = Word.WdStyleSort.wdStyleSortByName
    End If
End Sub

S’applique à