Hello,
I need to remove some of the paragraphs from a Word document (.docx). I tried
several ways using POI XWPF. The simplest way seems to use
removeBodyElement(int pos) method in the XWPFDoument class.
XWPFDocument doc = new XWPFDocument(new FileInputStream("test.docx"));
List bodyElementList = doc.getBodyElements();
doc.removeBodyElement(pos); // pos is the position of BodyELement to be removed
The problem of this approach is that the "pos" has to be determined in the run
time, i.e. I have to check the contents of the BodyElement before I remove it.
It seems that there is no such method for user to get text from a BodyElement.
Could anyone advise how to get text from an BodyElement? Thanks in advance!
Best regards,
ShuiChen
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]