How to insert an image into a Docx File at a bookmark, yet WITHOUT LOSING this bookmark?

After long time debug, the real cause is the position of the bm.setText call

in my old code, we call builder.insertImage before bm.setText(""), and it seems that the bm.setText("") will flush the image, so there is nothing left.

Now I use the same sequence as your code, call bm.setText("") before builder.insertImage , and it works fine at last!

Without your working example code, I would never find it!

@zwei It is perfect that you managed to resolve the problem. Please feel free to ask in case of any issues, we are always glad to help you.

1 Like