Bookmark.Sort Method
Sorts the paragraphs in the Bookmark control.
Assembly: Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
void Sort( ref Object ExcludeHeader, ref Object FieldNumber, ref Object SortFieldType, ref Object SortOrder, ref Object FieldNumber2, ref Object SortFieldType2, ref Object SortOrder2, ref Object FieldNumber3, ref Object SortFieldType3, ref Object SortOrder3, ref Object SortColumn, ref Object Separator, ref Object CaseSensitive, ref Object BidiSort, ref Object IgnoreThe, ref Object IgnoreKashida, ref Object IgnoreDiacritics, ref Object IgnoreHe, ref Object LanguageID )
Parameters
- ExcludeHeader
- Type: Object
true to exclude the first row or paragraph header from the sort operation. The default value is false.
- FieldNumber
- Type: Object
The fields to sort by. Microsoft Office Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.
- SortFieldType
- Type: Object
The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortFieldType constants.
- SortOrder
- Type: Object
The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortOrder constants.
- FieldNumber2
- Type: Object
The fields to sort by. Microsoft Office Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.
- SortFieldType2
- Type: Object
The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortFieldType constants
- SortOrder2
- Type: Object
The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortOrder constants.
- FieldNumber3
- Type: Object
The fields to sort by. Microsoft Office Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.
- SortFieldType3
- Type: Object
The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortFieldType constants
- SortOrder3
- Type: Object
The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the WdSortOrder constants.
- SortColumn
- Type: Object
true to sort only the column specified by the Bookmark control.
- Separator
- Type: Object
Object. The type of field separator. Can be one of the WdSortSeparator constants.
- CaseSensitive
- Type: Object
true to sort with case sensitivity. The default value is false.
- BidiSort
- Type: Object
true to sort based on right-to-left language rules. This argument might not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
- IgnoreThe
- Type: Object
true to ignore the Arabic characters alef lam when sorting right-to-left language text. This argument might not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
- IgnoreKashida
- Type: Object
true to ignore kashidas when sorting right-to-left language text. This argument might not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
- IgnoreDiacritics
- Type: Object
true to ignore bidirectional control characters when sorting right-to-left language text. This argument might not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
- IgnoreHe
- Type: Object
true to ignore the Hebrew character he when sorting right-to-left language text. This argument might not be available to you, depending on the language support (U.S. English, for example) that you have selected or installed.
- LanguageID
- Type: Object
Specifies the sorting language. Can be one of the WdLanguageID constants.
Optional Parameters
For information on optional parameters, see Optional Parameters in Office Solutions.
The following code example adds a Bookmark control with a list of fruits and then sorts the list in ascending order.
This example is for a document-level customization.
private void BookmarkSort() { this.Paragraphs[1].Range.InsertParagraphBefore(); Microsoft.Office.Tools.Word.Bookmark bookmark1 = this.Controls.AddBookmark(this.Paragraphs[1].Range, "bookmark1"); bookmark1.Text = "Oranges" + "\n" + "Bananas" + "\n" + "Apples" + "\n" + "Pears"; object SortOrder = Word.WdSortOrder.wdSortOrderAscending; bookmark1.Sort(ref missing, ref missing, ref missing, ref SortOrder, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); }
- 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.