Bookmark.SortAscending Method ()

 

Sorts paragraphs or table rows in ascending alphanumeric order within a Bookmark control.

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

void SortAscending()

The following code example adds a list of fruits to a Bookmark control and then sorts the list in ascending order.

This example is for a document-level customization.

private void BookmarkSortAscending()
{
    this.Paragraphs[1].Range.InsertParagraphBefore();

    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "Fruit" + "\n" + "Oranges" + "\n" +
        "Bananas" + "\n" + "Apples" + "\n" + "Pears";
    bookmark1.SortAscending();
}
Return to top
Show: