Expand Minimize

DocumentBase.StyleSortMethod Property

Gets or sets a value that specifies the sort method to use when sorting styles in the Styles task pane.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public WdStyleSort StyleSortMethod { get; set; }

Property Value

Type: Microsoft.Office.Interop.Word.WdStyleSort
One of the WdStyleSort values.

The following code example displays the current sort method for the Styles task pane. Next, if the current sort method is not the alphabetical sort method, the code displays a message that informs the user that the sort method is about to be modified, and then modifies the sort method to the alphabetical sort order. To use this example, run it from the ThisDocument class in a document-level project.

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;

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2015 Microsoft