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

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
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
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodCode exampleRemove
Removes the bookmark from the document. Does not remove text inside the bookmark.
Public methodToString
Returns a string that represents the current object.
(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.
[C#]

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