When a textparagraph is deleted, programmatically it seems as if the deletion has been applied. However, the textparagraph is still visible in the slide of the slideshow. (The same problem occurs with textruns, cf. another filed bug.) Steps to reproduce: @Test void removeTextParagraph() throws IOException { final XMLSlideShow ppt = new XMLSlideShow(); final XSLFSlide slide = ppt.createSlide();; final XSLFTextBox textBox = slide.createTextBox(); textBox.setAnchor(new Rectangle(0, 0, 100, 100)); textBox.getTextParagraphs().get(0).getTextRuns().get(0).setText("lorem"); textBox.addNewTextParagraph().addNewTextRun().setText("ipsum"); textBox.addNewTextParagraph().addNewTextRun().setText("dolor"); assertEquals(3, textBox.getTextParagraphs().size()); assertEquals("lorem\nipsum\ndolor", textBox.getText()); assertEquals("lorem", textBox.getTextParagraphs().get(0).getText()); assertEquals("ipsum", textBox.getTextParagraphs().get(1).getText()); assertEquals("dolor", textBox.getTextParagraphs().get(2).getText()); textBox.getTextParagraphs().remove(textBox.getTextParagraphs().get(1)); assertEquals(2, textBox.getTextParagraphs().size()); assertEquals("lorem\ndolor", textBox.getText()); assertEquals("lorem", textBox.getTextParagraphs().get(0).getText()); assertEquals("dolor", textBox.getTextParagraphs().get(1).getText()); String filepath = System.getProperty("java.io.tmpdir") + "tmp.pptx"; FileOutputStream fos = new FileOutputStream(filepath); ppt.write(fos); fos.close(); System.out.println("file written to " + filepath); } see also: https://user.poi.apache.narkive.com/S6TaNfG4/delete-specific-xslftextparagraph-in-xslfshape
I added r1898668 - would you be in a position to test this? The problem is that textBox.getTextParagraphs().remove(...) does not remove the underlying XMLBeans data (CTTextParagraph class). If you want to work around the issue without my change, you can get the CTTextBody for the XSLFTextBox using textBox.getTextBody().getXmlObject(). You can then iterate over the 'p' array to find the right CTTextParagraph to remove.
I was able to verify that the change works. The above test initially failed with an UnsupportedOperationException. Great idea to change the list of textparagraphs to Collections.unmodifiableList. :-) After replacing the line textBox.getTextParagraphs().remove(textBox.getTextParagraphs().get(1)); with textBox.removeTextParagraph(textBox.getTextParagraphs().get(1)); the test passed again and the slide finally looks as expected. Thanks for fixing the issue!