use of org.apache.poi.hwpf.usermodel.Bookmarks in project poi by apache.
the class HWPFLister method dumpBookmarks.
private void dumpBookmarks() {
if (!(_doc instanceof HWPFDocument)) {
System.out.println("Word 95 not supported so far");
return;
}
HWPFDocument document = (HWPFDocument) _doc;
Bookmarks bookmarks = document.getBookmarks();
for (int b = 0; b < bookmarks.getBookmarksCount(); b++) {
Bookmark bookmark = bookmarks.getBookmark(b);
System.out.println("[" + bookmark.getStart() + "; " + bookmark.getEnd() + "): " + bookmark.getName());
}
}
use of org.apache.poi.hwpf.usermodel.Bookmarks in project poi by apache.
the class TestBookmarksTables method test.
public void test() {
HWPFDocument doc = HWPFTestDataSamples.openSampleFile("pageref.doc");
Bookmarks bookmarks = doc.getBookmarks();
assertEquals(1, bookmarks.getBookmarksCount());
Bookmark bookmark = bookmarks.getBookmark(0);
assertEquals("userref", bookmark.getName());
assertEquals(27, bookmark.getStart());
assertEquals(38, bookmark.getEnd());
}
Aggregations