Hi, I some some simple java code to insert an image in Word like this:
DocumentBuilder builder = new DocumentBuilder(doc); //doc is a existing Aspose Word object
builder.moveToBookmark("ALJSignDateDec2", false, false);
URL url = new URL(barcodeUrl); //hardcoded url value
BufferedImage bufferedImage = ImageIO.read(url); //this part works
builder.insertImage(bufferedImage ); //image inserted fine
...
it works well as expected. But I need to find a way to delete the same image file later . My current code is like this:
Bookmark barcodeIamge = pkg.getRange().getBookmarks().get(“ALJSignDateDec2”);
barcodeIamge.getBookmarkStart().getNextSibling().remove();
It always gives me null pointer exception no matter I try NextSibling, PreviousSibling, bookmarkStart or bookmarkEnd.
Do you have any solution?
Thanks.