DocumentBase.StyleSortMethod, propriété

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.

Espace de noms :  Microsoft.Office.Tools.Word
Assembly :  Microsoft.Office.Tools.Word.v4.0.Utilities (dans Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

Syntaxe

'Déclaration
Public Property StyleSortMethod As WdStyleSort
    Get
    Set
public WdStyleSort StyleSortMethod { get; set; }

Valeur de propriété

Type : Microsoft.Office.Interop.Word.WdStyleSort
Une des valeurs de WdStyleSort.

Exemples

L'exemple de code suivant affiche la méthode de tri actuelle pour le volet de tâches 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 change la méthode de tri selon l'ordre alphabétique. Pour utiliser cet exemple, exécutez-le à partir de la classe ThisDocument dans un projet au niveau du document.

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
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;
    }            
}

Sécurité .NET Framework

Voir aussi

Référence

DocumentBase Classe

Microsoft.Office.Tools.Word, espace de noms