We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need to remove an image from word document

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.);

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.

Please share your sample document file with us for our analysis. We will test it here and provide feedback accordingly.