https://bz.apache.org/bugzilla/show_bug.cgi?id=65934

            Bug ID: 65934
           Summary: removed textparagraphs remain visible in slideshow
           Product: POI
           Version: 5.2.0-FINAL
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSLF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

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

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to