Summary: | SlideShow.removeSlide makes PPT corrupted | ||
---|---|---|---|
Product: | POI | Reporter: | Constantin <cvolozhin> |
Component: | HSLF | Assignee: | POI Developers List <dev> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | P1 | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | All | ||
Attachments: |
TestSlide.ppt
Screenshot Another PPT PowerPoint file |
Description
Constantin
2009-05-25 06:33:50 UTC
Created attachment 23711 [details]
TestSlide.ppt
Created attachment 23712 [details]
Screenshot
Is this error with POI-3.2 FINAL or on the current trunk? Would you please describe your use case within your production. (In reply to comment #3) > Is this error with POI-3.2 FINAL or on the current trunk? > > Would you please describe your use case within your production. On trunk and on 3.2. I use this method to remove slides. Should be fixed in r786501. PowerPoint wasn't happy to find orphan references to notes belonging to the deleted slide. P.S. PowerPoint 2007 silently ignored this bug, the alert was only in PowerPoint 2003 and older. Yegor Created attachment 23844 [details]
Another PPT
Thanks for quick feedback, Yegor,
but bug still here.
I have attached another PPT, that still causes error.
Could you check please?
Use the same code snippet.
Should be fixed in r788948. There was a typo that prevented deletion of slide's notes. Regards, Yegor Created attachment 24364 [details]
PowerPoint file
Code snippet:
import java.io.FileInputStream;
import org.apache.poi.hslf.model.Slide;
import org.apache.poi.hslf.usermodel.SlideShow;
public class POITest {
public static void main(String[] args) throws Exception {
SlideShow ppt = new SlideShow(new FileInputStream("tt2.ppt"));
Slide[] slides = ppt.getSlides();
for (int i = 0; i < slides.length; i++) {
ppt.removeSlide(0);
}
Slide newSlide = ppt.createSlide();
}
}
This code generates following error:
Exception in thread "main" java.lang.IllegalStateException: The last child record of a Document should be EndDocument, but it was org.apache.poi.hslf.record.UnknownRecordPlaceholder@12d96f2
at org.apache.poi.hslf.record.Document.addSlideListWithText(Document.java:179)
at org.apache.poi.hslf.usermodel.SlideShow.createSlide(SlideShow.java:700)
at POITest.main(POITest.java:19)
With removeSlide commented works ok.
tt2.ppt attached (file received from our customer)
Constantin, Please don't abuse Bugzilla. Changing the priority of a bug to Blocker will not help us to fix it sooner. If you are really interested in fixing this bug - you are welcome to do a research and figure out which bits in the PPT format are broken. If you need a guidance, please ask, I will be happy to help. Yegor Fix applied with r1648458 Although saving a PPT without slides doesn't make sense, there was a problem with an optional RoundTripCustomTableStyles12Atom, which occured when all slides were removed and new slides created afterwards - this is fixed now. |