java.lang.Object
com.aspose.words.BookmarkCollection
public class BookmarkCollection
Example:
Document doc = new Document(getMyDir() + "Bookmarks.doc");
// By index.
Bookmark bookmark1 = doc.getRange().getBookmarks().get(0);
// By name.
Bookmark bookmark2 = doc.getRange().getBookmarks().get("Bookmark2");
| Property Getters/Setters Summary | ||
|---|---|---|
int | getCount() | |
| Returns the number of bookmarks in the collection. | ||
Bookmark | get(int index) | |
| Returns a bookmark at the specified index. | ||
Bookmark | get(java.lang.String bookmarkName) | |
| Returns a bookmark by name. | ||
| Method Summary | ||
|---|---|---|
void | clear() | |
| Removes all bookmarks from this collection and from the document. | ||
java.util.Iterator | iterator() | |
| Returns an enumerator object. | ||
void | remove(Bookmark bookmark) | |
| Removes the specified bookmark from the document. | ||
void | remove(java.lang.String bookmarkName) | |
| Removes a bookmark with the specified name. | ||
void | removeAt(int index) | |
| Removes a bookmark at the specified index. | ||
| Property Getters/Setters Detail |
|---|
getCount | |
public int getCount() | |
Example:
Shows how to count the number of bookmarks in a document.Document doc = new Document(getMyDir() + "Bookmark.doc"); int count = doc.getRange().getBookmarks().getCount();
get | |
public Bookmark get(int index) | |
The index is zero-based.
Negative indexes are allowed and indicate access from the back of the collection. For example -1 means the last item, -2 means the second before last and so on.
If index is greater than or equal to the number of items in the list, this returns a null reference.
If index is negative and its absolute value is greater than the number of items in the list, this returns a null reference.
index - An index into the collection.Example:
Shows how to obtain bookmarks from a bookmark collection.
Document doc = new Document(getMyDir() + "Bookmarks.doc");
// By index.
Bookmark bookmark1 = doc.getRange().getBookmarks().get(0);
// By name.
Bookmark bookmark2 = doc.getRange().getBookmarks().get("Bookmark2");get | |
public Bookmark get(java.lang.String bookmarkName) | |
Returns null if the bookmark with the specified name cannot be found.
bookmarkName - Case-insensitive name of the bookmark.Example:
Shows how to obtain bookmarks from a bookmark collection.
Document doc = new Document(getMyDir() + "Bookmarks.doc");
// By index.
Bookmark bookmark1 = doc.getRange().getBookmarks().get(0);
// By name.
Bookmark bookmark2 = doc.getRange().getBookmarks().get("Bookmark2");| Method Detail |
|---|
clear | |
public void clear()
throws java.lang.Exception | |
Example:
Shows how to remove all bookmarks from a document.Document doc = new Document(getMyDir() + "Bookmark.doc"); doc.getRange().getBookmarks().clear();
iterator | |
public java.util.Iterator iterator() | |
remove | |
public void remove(Bookmark bookmark) throws java.lang.Exception | |
bookmark - The bookmark to remove.Example:
Demonstrates different methods of removing bookmarks from a document.
Document doc = new Document(getMyDir() + "Bookmarks.doc");
// Remove a particular bookmark from the document.
Bookmark bookmark = doc.getRange().getBookmarks().get(0);
doc.getRange().getBookmarks().remove(bookmark);
// Remove a bookmark by specified name.
doc.getRange().getBookmarks().remove("Bookmark2");
// Remove a bookmark at the specified index.
doc.getRange().getBookmarks().removeAt(0);remove | |
public void remove(java.lang.String bookmarkName)
throws java.lang.Exception | |
bookmarkName - The case-insensitive name of the bookmark to remove.Example:
Demonstrates different methods of removing bookmarks from a document.
Document doc = new Document(getMyDir() + "Bookmarks.doc");
// Remove a particular bookmark from the document.
Bookmark bookmark = doc.getRange().getBookmarks().get(0);
doc.getRange().getBookmarks().remove(bookmark);
// Remove a bookmark by specified name.
doc.getRange().getBookmarks().remove("Bookmark2");
// Remove a bookmark at the specified index.
doc.getRange().getBookmarks().removeAt(0);removeAt | |
public void removeAt(int index)
throws java.lang.Exception | |
index - The zero-based index of the bookmark to remove.Example:
Demonstrates different methods of removing bookmarks from a document.
Document doc = new Document(getMyDir() + "Bookmarks.doc");
// Remove a particular bookmark from the document.
Bookmark bookmark = doc.getRange().getBookmarks().get(0);
doc.getRange().getBookmarks().remove(bookmark);
// Remove a bookmark by specified name.
doc.getRange().getBookmarks().remove("Bookmark2");
// Remove a bookmark at the specified index.
doc.getRange().getBookmarks().removeAt(0);