Bookmark Class
Represents the bookmark (pair of BookmarkStart and BookmarkEnd elements).
- Inheritance:
- System.ObjectBookmark
Remarks
A Bookmark object serves as a façade for BookmarkStart and BookmarkEnd elements.
Bookmark objects can be retrieved from Bookmarks collection. Bookmarks collection contains all bookmarks in the document. Use Bookmarks collection to retrieve a Bookmark with a specified name, iterate over all bookmarks or remove a bookmark.
Bookmarks are usually used in a conjunction with Hyperlinks or Fields for navigating to a bookmarked part of the document or to render a page number (or some other information) of a bookmarked part of the document. For more information, see Bookmarks and Hyperlinks and Modify Bookmarks examples.
Properties
End
Gets the BookmarkEnd element.
Property Value
The BookmarkEnd element.
Name
Gets the bookmark name.
Property Value
- System.String
The bookmark name.
Start
Gets the BookmarkStart element.
Property Value
The BookmarkStart element.
Methods
GetContent(Boolean)
Gets the content of the current Bookmark.
public ContentRange GetContent(bool includeBookmarkStartEnd)
Public Function GetContent(includeBookmarkStartEnd As Boolean) As ContentRange
Parameters
includeBookmarkStartEnd
- System.Boolean
if set to true, returned ContentRange will also contain Start and End elements, otherwise it won't.
Returns
The content of the current Bookmark.
Remarks
Following table explains how includeBookmarkStartEnd
parameter value affects on the behavior of methods of the returned ContentRange:
includeBookmarkStartEnd is false | includeBookmarkStartEnd is true | |
---|---|---|
Delete() method | Deletes content between Start and End, leaving the Start and End in the document. | Deletes content between Start and End, removing the Start and End from the document, thus removing the current Bookmark from the document (Bookmarks collection). |
LoadText(String) and Set(ContentRange) methods | Sets new bookmarked content, leaving the Start and End in the document. | Sets new bookmarked content, removing the Start and End from the document, thus removing the current Bookmark from the document (Bookmarks collection). |
For more information, see modify bookmarks example.