Expand Minimize
This topic has not yet been rated - Rate this topic

Bookmark.End Property

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Gets or sets the ending character position of a Bookmark control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
int End { get; set; }

Property Value

Type: System.Int32
The ending character position of a Bookmark control.

The Bookmark control has a starting position and an ending position. The ending position is the point farthest away from the beginning of the Bookmark control. Use the End property to change the size of the Bookmark control.

If this property is set to a value smaller than the Start property, the Start property is set to the same value (that is, the Start and End property are equal).

The following code example adds a Bookmark control with text to the first paragraph and then adds another Bookmark control to the third word in the first bookmark. The code then moves the range of the second bookmark until it finds the character K.

This example is for a document-level customization.

private void BookmarkMoveEndUntil()
{
    Microsoft.Office.Tools.Word.Bookmark bookmark1 =
        this.Controls.AddBookmark(this.Paragraphs[1].Range,
        "bookmark1");
    bookmark1.Text = "This is sample bookmark text.";

    Microsoft.Office.Tools.Word.Bookmark bookmark2 =
        this.Controls.AddBookmark(bookmark1.Words[3],
        "bookmark2");

    object Count = bookmark1.Characters.Count;
    object cSet = "k";

    bookmark2.MoveEndUntil(ref cSet, ref Count);
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.