Hi,
I have an application which extracts slide information from uploaded ppt documents, then uses it to generate ppt and pptx documents.
The application extracts the place of the slide in a presentation using the SlidePosition property:
PlaceInPresentation = slide.SlidePosition;
then it uses this to generate a ppt document, using a clone method to insert the slide:
//PPT
foreach (var slide in slides)
{
// load the source presentation
Aspose.Slides.Presentation srcPres = new Aspose.Slides.Presentation(slide.FilePath);
Aspose.Slides.Slide srcSlide = srcPres.GetSlideByPosition(slide.PlaceInSourcePresentation);
//Creating SortedList object
SortedList sList = new SortedList();
//Clone the source presentation to the target
srcPres.CloneSlide(srcSlide, slide.PlaceInTargetPresentation, targetPres, sList);
}
and similarly when generating a pptx document:
// PPTX
foreach (var s in slides)
{
// get the source slide
PresentationEx srcPres = new PresentationEx(s.FilePath);
SlideEx srcSlide = srcPres.Slides[s.PlaceInSourcePresentation - 1];
// add slide to target presentation
targetPres.Slides.InsertClone(s.PlaceInTargetPresentation, srcSlide);
}
Now, this code works fine except when the place in the source presentation is 1.Then the application generates an error. I’ve tried with multiple presentations, the error is always the same. Any idea why?