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

            Bug ID: 65935
           Summary: removed textruns 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 textrun is deleted, programmatically it seems as if the deletion has
been applied. However, the textrun is still visible in the slide of the
slideshow. (The same problem occurs with textparagraphs, cf. another filed bug
65934.)

Steps to reproduce:

  @Test
  void removeTextRun() throws IOException {
    final XMLSlideShow ppt = new XMLSlideShow();

    final XSLFSlide slide = ppt.createSlide();;

    final XSLFTextBox textBox = slide.createTextBox();
    textBox.setAnchor(new Rectangle(0,0,250,100));

    final XSLFTextParagraph textParagraph = textBox.getTextParagraphs().get(0);

    textParagraph.getTextRuns().get(0).setText("lorem ");
    textParagraph.addNewTextRun().setText("ipsum ");
    textParagraph.addNewTextRun().setText("dolor");

    assertEquals(1, textBox.getTextParagraphs().size());
    assertEquals(3, textBox.getTextParagraphs().get(0).getTextRuns().size());

    assertEquals("lorem ipsum dolor", textBox.getText());
    assertEquals("lorem ipsum dolor",
textBox.getTextParagraphs().get(0).getText());
    assertEquals("lorem ",
textBox.getTextParagraphs().get(0).getTextRuns().get(0).getRawText());
    assertEquals("ipsum ",
textBox.getTextParagraphs().get(0).getTextRuns().get(1).getRawText());
    assertEquals("dolor",
textBox.getTextParagraphs().get(0).getTextRuns().get(2).getRawText());

   
textBox.getTextParagraphs().get(0).getTextRuns().remove(textBox.getTextParagraphs().get(0).getTextRuns().get(1));

    assertEquals(1, textBox.getTextParagraphs().size());
    assertEquals(2, textBox.getTextParagraphs().get(0).getTextRuns().size());

    assertEquals("lorem dolor", textBox.getText());
    assertEquals("lorem dolor", textBox.getTextParagraphs().get(0).getText());
    assertEquals("lorem ",
textBox.getTextParagraphs().get(0).getTextRuns().get(0).getRawText());
    assertEquals("dolor",
textBox.getTextParagraphs().get(0).getTextRuns().get(1).getRawText());

    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);
  }

-- 
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