We have an image in the word document we need to remove in some cases. We bookmarked it and tried this:
BookmarkCollection bookmarks = doc.getRange().getBookmarks();
Bookmark plus = bookmarks.get("plusimage");
Shape plusShape = (Shape) plus.getBookmarkStart().getAncestor(NodeType.);
plusShape.remove();
But we got a null pointer exception on the last line. We wondering if we cast this to the right object or if there is some better way to remove the image.