Hi, I need to remove all content in my word document (including images, tables and text).
I had tried using:
InputStream stream = new FileInputStream("C:\Users\Feng Jun Wendell\Desktop\JavaApplication\Testing.docx");
Document doc = new Document(stream);
stream.close();
Section section = doc.getSections().get(0);
Body body = section.getBody();
for (Node node = body.getFirstChild(); node != null; node = node.getNextSibling())
{
node.remove();
}
But the contents in the document remains intact and nothing was changed.
Thanks in advance to anyone who could help me with my problem.