DocumentBase.StyleSortMethod Właściwość

Definicja

Pobiera lub ustawia wartość określającą metodę sortowania do użycia podczas sortowania stylów w okienku zadań Style.

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

Wartość właściwości

Jedna z WdStyleSort wartości.

Przykłady

Poniższy przykład kodu przedstawia bieżącą metodę sortowania dla okienka zadań Style . Następnie, jeśli bieżąca metoda sortowania nie jest metodą sortowania alfabetycznego, kod wyświetla komunikat informujący użytkownika, że metoda sortowania ma zostać zmodyfikowana, a następnie modyfikuje metodę sortowania do kolejności sortowania alfabetycznego. Aby użyć tego przykładu ThisDocument , uruchom go z klasy w projekcie na poziomie dokumentu.

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

Dotyczy