*/
public boolean removeRun(int pos){
if (pos >= 0 && pos < paragraph.sizeOfRArray()) {
- getCTP().removeR(pos);
+ // Remove the run from our high level lists
+ XWPFRun run = runs.get(pos);
runs.remove(pos);
+ iruns.remove(run);
+ // Remove the run from the low-level XML
+ getCTP().removeR(pos);
return true;
}
return false;
XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("56392.docx");\r
assertNotNull(doc);\r
}\r
+ \r
+ /**\r
+ * Removing a run needs to remove it from both Runs and IRuns\r
+ */\r
+ @Test\r
+ public void test57829() throws Exception {\r
+ XWPFDocument doc = XWPFTestDataSamples.openSampleDocument("sample.docx");\r
+ assertNotNull(doc);\r
+ assertEquals(3, doc.getParagraphs().size());\r
+ \r
+ for (XWPFParagraph paragraph : doc.getParagraphs()) {\r
+ paragraph.removeRun(0);\r
+ assertNotNull(paragraph.getText());\r
+ }\r
+ }\r
}\r