public void BookmarkNameAndText()
{
//ExStart
//ExFor:Bookmark
//ExFor:Bookmark.Name
//ExFor:Bookmark.Text
//ExFor:Range.Bookmarks
//ExId:BookmarksGetNameSetText
//ExSummary: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.
Aspose.Words.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.";
//ExEnd
Assert.AreEqual("MyBookmark", name);
Assert.AreEqual("This is a bookmarked text.", text);
}