Count Number of Slides using Apache POI and Aspose.Slides

Aspose.Slides - Count Number of Slides

Slides can be counted by calling size method after getting all slides of presentation.

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

System.out.println("Total Slides in Count: " + pres.getSlides().size());

Apache POI SL - HSLF XSLF - Count Number of Slides

Slides can be counted by accessing length property after getting all slides of presentation.

SlideShow ppt = new SlideShow(new FileInputStream("presentation.ppt"));

System.out.println("Total Slides Count: " + ppt.getSlides().length);

Download Running Code

Download Sample Code