Document.StyleSortMethod Property (2007 System)
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.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)
Syntax
'Declaration
Public Property StyleSortMethod As WdStyleSort
'Usage
Dim instance As Document
Dim value As WdStyleSort
value = instance.StyleSortMethod
instance.StyleSortMethod = value
public WdStyleSort StyleSortMethod { get; set; }
public:
property WdStyleSort StyleSortMethod {
WdStyleSort get ();
void set (WdStyleSort value);
}
public function get StyleSortMethod () : WdStyleSort
public function set StyleSortMethod (value : WdStyleSort)
Property Value
Type: WdStyleSort
One of the WdStyleSort values.
Examples
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.
This example is for a document-level customization.
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;
}
}
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.