We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How can I get the index of slide?

How can I get the index position of a slide in the slides collection if I know either the position or have a reference to it?

More details...

I'm processing my slides in position order, using:

for (int slideIndex = 1; slideIndex<=outputPresentation.Slides.LastSlidePosition; slideIndex++)
slide = outputPresentation.GetSlideByPosition(slideIndex); // march through in order ...

And then I want to delete some of the slides (after processing them all)...

What I'm looking for is a way to delete the slide at (for example) position 7 and 3 (but how do I get their index so I can use outputPresentation.Slides.RemoveAt(index)?

Hi Ken,

Thanks for your interest in Aspose.Slides.

Please note that you can remove slide either by index or by slide. The index correspond to slide in Slides[] list. it starts from 0 to n-1. where n is last slide. So, index actually correspond to slide position -1. The following code snippet describes the possible ways to remove the slide. It is to be noted that both remove functions are deleting the same first slide in presentation. One is removing slide w.r.t slide index and other is removing w.r.t to slide itself.

Slide sld=Pres_Source.GetSlideByPosition(1);


Slide sld=Pres_Source.Slides[0];




Thanks and Regards,