This example inserts a bookmark at the beginning of the first paragraph.
try { Application application = Application.getInstance(); Documents documents = application.getDocuments(); Document document = documents.openDocument("C:\\bookmark.odt", true); Bookmarks bookmarks = document.getBookmarks(); Bookmark bookmark = bookmarks.add("FirstBookmark", document.getParagraphs().item(1).getRange().getStart());} catch(Exception e) { e.printStackTrace(); }
Related information