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

Bookmark.IsEqual Method

Determines if the Bookmark control to which this method is applied is equal to the range specified by the Range argument.

Namespace: Microsoft.Office.Tools.Word
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)

public bool IsEqual (
	Range Range
)

Parameters

Range

The Range object that is compared with the Bookmark control.

Return Value

true if the Bookmark control to which this method is applied is equal to the range specified by the Range argument; otherwise, false.

This method compares the starting and ending character positions, as well as the story type. If all three of these items are the same for both objects, the objects are equal.

Optional Parameters

For information on optional parameters, see Understanding Optional Parameters in COM Interop.

The following code example adds a Bookmark control with text to the document and checks to find out whether or not the range of the bookmark is equal to the range of the first paragraph.

private void BookmarkIsEqual()
{
    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.";
    bookmark1.InsertAfter(" This is additional text.");
    if (bookmark1.IsEqual(this.Paragraphs[1].Range))
    {
        MessageBox.Show("The bookmark's range is equal to "+
            "the range of the first paragraph.");
    }
    else
    {
        MessageBox.Show("The bookmark's range is not equal to " +
            "the range of the first paragraph.");
    }
}

Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.