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

Bookmark.MoveStartUntil Method

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

Moves the start position of the Bookmark control until one of the specified characters is found in the document.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word (in Microsoft.Office.Tools.Word.dll)
int MoveStartUntil(
	ref Object cset,
	ref Object count
)

Parameters

cset
Type: System.Object

One or more characters. This argument is case sensitive.

count
Type: System.Object

The maximum number of characters by which the Bookmark control is to be moved. Can be a number or either the wdForward or wdBackward constant. If Count is a positive number, the Bookmark control is moved forward in the document. If it is a negative number, the Bookmark control is moved backward. The default value is wdForward.

Return Value

Type: System.Int32
The number of characters by which the start position of the Bookmark control moved. If Count is greater than 0 (zero), this method returns the number of characters moved plus 1. If Count is less than 0 (zero), this method returns the number of characters moved minus 1. If no Cset characters are found, the Bookmark control is not changed and the method returns 0 (zero).

If the movement is backward through the document, the Bookmark control is expanded.

If the start position is moved forward to a point beyond the end position, the Bookmark control is collapsed and both the start and end positions are moved together.

Optional Parameters

For information on optional parameters, see Optional Parameters in Office Solutions.

The following code example adds a Bookmark control with text to the first paragraph and then moves the range of the bookmark until it finds a space.

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);
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.