Bug 46021 - Basic non-destructive modification breaks powerpoint file
Summary: Basic non-destructive modification breaks powerpoint file
Status: RESOLVED REMIND
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.1-FINAL
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-16 04:43 UTC by Reggie Carey
Modified: 2015-07-07 11:21 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.