I have a requirement that I need to reformat a document. So I create a new document, then read the contents of the old document and write them into the new document. The general framework is as follows.
Document document = new Document(filePath);
for (Section section : document.getSections()) {
for (Paragraph paragraph: section.getBody().getParagraphs()) {
write;
}
}
I don’t know how to read the old document table and then write it to the same location as the new document. I hope it can help me.