Wiki

Clone wiki

Aspose for Apache POI / Delete-Slides-from-Presentation

Apache POI SL

XMLSlideShow ppt = new XMLSlideShow(new FileInputStream("data/presentation.pptx"));

ppt.removeSlide(0); // 0-based index of a slide to be removed

Aspose.Slides

//Instantiate a PresentationEx object that represents a PPTX file
Presentation pres = new Presentation("data/presentation.pptx");

pres.getSlides().removeAt(1); //Removing a slide using its index

//===========================================================
//Accessing a slide using its index in the slides collection
ISlide slide = pres.getSlides().get_Item(0);
pres.getSlides().remove(slide); //Removing a slide using its reference

Download Source Code

Updated