The index passed into Slides.get(int) doesn't match with ppt

I tried aspose component for ppt recently. However, I find the the index passed into Slides.get(int) doesn’t match with ppt.

Could someone tell me why and how I should solve this problem?

Hi,

The Slides collection has zero based index. Here is the sample program for a presentation with three slides:

Slide sld1=pres.getSlides().get(0);

Slide sld2=pres.getSlides().get(1);

Slide sld3=pres.getSlides().get(2);

com.aspose.slides.Rectangle rect1= sld1.getShapes().addRectangle(100, 100, 150, 150);

rect1.addTextFrame("Slide 0");

com.aspose.slides.Rectangle rect2= sld2.getShapes().addRectangle(100, 100, 150, 150);

rect2.addTextFrame("Slide 1");

com.aspose.slides.Rectangle rect3= sld3.getShapes().addRectangle(100, 100, 150, 150);

rect3.addTextFrame("Slide 2");

I know that, I mean the order does not match

You should use Presentation.getSlideByPosition() instead of Slides.get() to get slides in the correct order. Slide positions are numbered from 1.

I don’t care about whether the indices starts with 0 or 1. But I wonder why Slides#get(int) is not the correct order?

Thanks anywa

PowerPoint stores slides in the PPT file in the order of creation and Slides.get() returns slides in this native PPT order.