Bug 46021

Summary: Basic non-destructive modification breaks powerpoint file
Product: POI Reporter: Reggie Carey <reggie.carey>
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED REMIND    
Severity: major    
Priority: P1    
Version: 3.1-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   

Description Reggie Carey 2008-10-16 04:43:44 UTC
The following code snippet will cause exceptions and errors on many powerpoint documents and will generally result in corrupted file output:

Exception handling, imports removed for clarity.

public class TestPowerPoint
{

 public static void main(String[] args)
 {
  new TestPowerPoint(args[0]);
 }

 public TestPowerPoint(String fileToTest)
 {
  SlideShow ppt = new SlideShow(new FileInputStream(fileToTest));
  for (Slide slide : ppt.getSlides())
  {
   for (TextRun textRun : slide.getTextRuns())
   {
    for (RichTextRun richTextRun : textRun.getRichTextRuns())
    {
    String text = richTextRun.getText();
    richTextRun.setText(text);
    }
   }
  }
  ppt.write(new FileOutputStream("new"+fileToTest));
 }

}
Comment 1 Yegor Kozlov 2008-10-17 08:21:26 UTC
Please attach the template ppt. Without it, it's hard to tell what is wrong.

Yegor
Comment 2 Dominik Stadler 2015-07-07 11:21:34 UTC
We did not get the necessary PPT attachment for a long time, thus resolving this for now.