Bookmark.IsEqual Method
Visual Studio 2005
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)
Assembly: Microsoft.Office.Tools.Word (in microsoft.office.tools.word.dll)
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."); } }