Compartilhar via


Bookmark.Start Property

Definition

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

public:
 property int Start { int get(); void set(int value); };
public int Start { get; set; }
member this.Start : int with get, set
Public Property Start As Integer

Property Value

The starting character position of a Bookmark control.

Examples

The following code example adds a Bookmark control with text to the first paragraph and then adds a second Bookmark control to the third word in the first bookmark. The code then moves the range of the first bookmark until it finds a space and redefines the bookmark size by changing the Start property.

This example is for a document-level customization.

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

    bookmark1.MoveStartUntil(ref cSet, ref Count);
}
Private Sub BookmarkMoveStartUntil()

    Me.Paragraphs(1).Range.InsertParagraphBefore()
    Dim Bookmark1 As Microsoft.Office.Tools.Word.Bookmark = _
        Me.Controls.AddBookmark(Me.Paragraphs(1).Range, "Bookmark1")
    Bookmark1.Text = "This is sample bookmark text."

    Bookmark1.MoveStartUntil(" ", Bookmark1.Characters.Count)
End Sub

Remarks

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 this property to change the size of the Bookmark control.

If this property is set to a value larger than that of the End property, the End property is set to the same value as that of Start property.

Applies to