Sort Method
Collapse the table of content
Expand the table of content

Bookmark.Sort Method (Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object)

 

Sorts the paragraphs in the Bookmark control.

Namespace:   Microsoft.Office.Tools.Word
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: System.Object

true to exclude the first row or paragraph header from the sort operation. The default value is false.

FieldNumber
Type: System.Object

The fields to sort by. Microsoft Office Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.

SortFieldType
Type: System.Object

The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the T:Microsoft.Office.Interop.Word.WdSortFieldType constants.

SortOrder
Type: System.Object

The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the T:Microsoft.Office.Interop.Word.WdSortOrder constants.

FieldNumber2
Type: System.Object

The fields to sort by. Microsoft Office Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.

SortFieldType2
Type: System.Object

The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the T:Microsoft.Office.Interop.Word.WdSortFieldType constants

SortOrder2
Type: System.Object

The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the T:Microsoft.Office.Interop.Word.WdSortOrder constants.

FieldNumber3
Type: System.Object

The fields to sort by. Microsoft Office Word sorts by FieldNumber, then by FieldNumber2, and then by FieldNumber3.

SortFieldType3
Type: System.Object

The respective sort types for FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the T:Microsoft.Office.Interop.Word.WdSortFieldType constants

SortOrder3
Type: System.Object

The sorting order to use when sorting FieldNumber, FieldNumber2, and FieldNumber3. Can be one of the T:Microsoft.Office.Interop.Word.WdSortOrder constants.

SortColumn
Type: System.Object

true to sort only the column specified by the Bookmark control.

Separator
Type: System.Object

Object. The type of field separator. Can be one of the T:Microsoft.Office.Interop.Word.WdSortSeparator constants.

CaseSensitive
Type: System.Object

true to sort with case sensitivity. The default value is false.

BidiSort
Type: System.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: System.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: System.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: System.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: System.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: System.Object

Specifies the sorting language. Can be one of the WdLanguageID constants.

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);
    }
Return to top
Show:
© 2016 Microsoft