Bookmark Class
Represents a single bookmark.
Inheritance Hierarchy
SystemObject
  Aspose.WordsBookmark

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.11
Syntax
public class Bookmark

The Bookmark type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleBookmarkEnd
Gets the node that represents the end of the bookmark.
Public propertyCode exampleBookmarkStart
Gets the node that represents the start of the bookmark.
Public propertyCode exampleName
Gets or sets the name of the bookmark.
Public propertyCode exampleText
Gets or sets the text enclosed in the bookmark.
Methods
  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodCode exampleRemove
Removes the bookmark from the document. Does not remove text inside the bookmark.
Public methodToString (Inherited from Object.)
Remarks

Bookmark is a "facade" object that encapsulates two nodes BookmarkStart and BookmarkEnd in a document tree and allows to work with a bookmark as a single object.

Examples
Shows how to get or set bookmark name and text.
Document doc = new Document(MyDir + "Bookmark.doc");

// Use the indexer of the Bookmarks collection to obtain the desired bookmark.
Bookmark bookmark = doc.Range.Bookmarks["MyBookmark"];

// Get the name and text of the bookmark.
string name = bookmark.Name;
string text = bookmark.Text;

// Set the name and text of the bookmark.
bookmark.Name = "RenamedBookmark";
bookmark.Text = "This is a new bookmarked text.";
See Also