DocumentBase.Bookmarks Property

 

Gets a Microsoft.Office.Interop.Word.Bookmarks collection that represents all the bookmarks in the document.

Namespace:   Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v4.0.Utilities (in Microsoft.Office.Tools.Word.v4.0.Utilities.dll)

public Bookmarks Bookmarks { get; }

Property Value

Type: Microsoft.Office.Interop.Word.Bookmarks

A Microsoft.Office.Interop.Word.Bookmarks collection that represents all the bookmarks in the document.

The following code example adds a Bookmark control to the first paragraph and then displays a message that shows the total number of bookmarks in the document. To use this example, run it from the ThisDocument class in a document-level project.

private void DocumentBookmarks()
{
    this.Paragraphs[1].Range.InsertParagraphAfter();
    this.Controls.AddBookmark(this.Paragraphs[1].Range, "bookmark1");
    MessageBox.Show("Total number of bookmarks: " + this.Bookmarks.Count.ToString());
}
Return to top
Show: