Example: exist method

This example adds a bookmark named "FirstBookmark" if there is no bookmark with the same name.

  boolean exist = false;
  exist = bookmarks.exists("FirstBookmark");
  if (!exist) {
      Bookmark bookmark = bookmarks.add("FirstBookmark", document
              .getParagraphs().item(1).getRange().getStart());
  }

Related information

exist method