Apache poi: remove Picture in XWPFDocument

2019-06-02 03:22发布

问题:

I'm writing an application that takes a .docx file with a bunch of empty paragraphs and tables and fills them programmatically using Apache POI with data from a db.

The .docx model I've been provided with also has a serie of pictures in it: my problem is I'd like to remove the ones I don't need (again, programmatically). I see there is a method for adding pictures to a XWPFRun (addPicture()) but not one for removing them.

Can this be done? How do you remove a picture from a .docx file with POI?

Thanks in advance!!