paragraphs

How to remove tables and paragraphs containing data from docx in java using apache poi

白昼怎懂夜的黑 提交于 2019-12-01 11:19:24
I have a word template that has multiple similar tables and some paragraphs associated to those tables placed just before them. Depending on the amount of data, I populate some tables and others are not required, so are there paragraphs. I need to remove these tables and paragraphs. As you can see in the image, I need to remove Table 2 and its paragraph Table Parahgraph Please help me how to do it. I tried using document.removeBodyElement(pos) , but it does not help. int startIndex = 0; int endIndex = 0; startIndex = doc.getPosOfTable(doc.getTables().get(0)); startIndex++; endIndex = doc

How to remove tables and paragraphs containing data from docx in java using apache poi

纵饮孤独 提交于 2019-12-01 09:38:49
问题 I have a word template that has multiple similar tables and some paragraphs associated to those tables placed just before them. Depending on the amount of data, I populate some tables and others are not required, so are there paragraphs. I need to remove these tables and paragraphs. As you can see in the image, I need to remove Table 2 and its paragraph Table Parahgraph Please help me how to do it. I tried using document.removeBodyElement(pos) , but it does not help. int startIndex = 0; int