|
Programmer's Reference >
WordApplication API >
Bookmark
The Bookmark Object
This class is used to represent a bookmark in the document. Bookmarks can be added to a document in Word or programmatically using WordWriter. They can only be retrieved form an existing document. To insert a bookmark into a document, use Document.CreateBookmark() or Table.CreateBookmarkOnRow(). To get a bookmark from an existing document, use Document.Bookmark(). The following sample shows you how to get add a bookmark to a document and retrieve a bookmark from a document.
Examples:
[csharp]
// Create a bookmark
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
Bookmark bmark = doc.CreateBookmark("MyBookmark");
// Get an existing bookmark
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
Bookmark bmark = doc.Bookmark("ExistingBookmark");
[vbnet]
' Create a bookmark
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim bmark As Bookmark = doc.CreateBookmark("MyBookMark")
' Get an existing bookmark
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim bmark As Bookmark = doc.Bookmark("ExistingBookmark")
Please note that this object inherits methods and properties not shown here from the following objects:
Bookmark Properties
| Property |
Type |
Access |
Description |
| Name |
String
|
read |
Returns a String representing the name of this bookmark.
|
This object does not have any methods defined.

Copyright 2007 © SoftArtisans, Inc. All Rights Reserved.
|