You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by sp0065 <sp...@gmail.com> on 2012/05/04 08:19:23 UTC
Problem with removing some slides with src.removeSlide()
I found a problem with removing some slides. It is only happening for some
slides in some presentations.
I have a three-slide presentation. src.removeSlide(1) removes slide 2 (1 in
0-base). Slide 2 is not there when I open output presentation in PowerPoint
but these files are still inside of the output file:
ppt/slides/slide2.xml
ppt/slides/_rels/slide2.xml
I did not have this problem with removing slide 1 or 3. Files slide1.xml,
slide3.xml were removed.
This is not a major issue because slide 2 is not visible and its content is
not indexed in my repository I am submitting slides to but I thought I would
let you know.
Below is my program I run. I cannot attach my problematic source three-slide
presentation here (let me know if I can send it over email).
Thank you.
import java.io.*;
import org.apache.poi.xslf.usermodel.*;
/**
* Remove slide
*/
public final class SplitPresentations {
public static void main(String args[]) throws Exception {
XMLSlideShow ppt_exc = new XMLSlideShow();
for(String arg : args){
FileInputStream is = new FileInputStream(arg);
XMLSlideShow src = new XMLSlideShow(is);
is.close();
//remove slide 2 (1 zero base)
src.removeSlide(1);
FileOutputStream out = new FileOutputStream("Present_without_sl_2.pptx");
src.write(out);
out.close();
}
}
}
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Problem-with-removing-some-slides-with-src-removeSlide-tp5684935.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Problem with removing some slides with src.removeSlide()
Posted by sp0065 <sp...@gmail.com>.
The reasons for the src.removeSlide(1) not removing files
ppt/slides/slide2.xml
ppt/slides/_rels/slide2.xml
related to slide 2 (1 in zero base) was that slide 2 was referenced in
/ppt/notesSlides/_rels/notesSlide1.xml.rels
as:
<Relationship Id="rId2"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"
Target="../slides/slide2.xml"/>
even there were no notes attached to any slide.
So I guess that is problem of "incorrect" structure of the source PPTX file.
--
View this message in context: http://apache-poi.1045710.n5.nabble.com/Problem-with-removing-some-slides-with-src-removeSlide-tp5684935p5687168.html
Sent from the POI - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org