This example adds a bookmark first, and then inserts some text after the bookmark, at last removes the bookmark.
import com.ibm.symphony.javaapi.Application; import com.ibm.symphony.javaapi.document.Bookmark; import com.ibm.symphony.javaapi.document.Bookmarks; import com.ibm.symphony.javaapi.document.Document; import com.ibm.symphony.javaapi.document.Documents; public class BookmarkExample { public void example() { try { Application application = Application.getInstance(); Documents documents = application.getDocuments(); Document document = documents .openDocument("C:\\bookmark.odt", true); Bookmarks bookmarks = document.getBookmarks(); boolean exist = false; exist = bookmarks.exists("FirstBookmark"); if (exist) System.out.println("the bookmark exist"); else System.out.println("the bookmark doesn't exist"); Bookmark bookmark = bookmarks.add("FirstBookmark", document .getParagraphs().item(1).getRange().getStart()); exist = bookmarks.exists("FirstBookmark"); if (exist) System.out.println("the bookmark exist"); else System.out.println("the bookmark doesn't exist"); bookmark.getRange().insertBefore("hello bookmark"); bookmark.remove(); } catch (Exception e) { e.printStackTrace(); } } }