Free Support Forum - aspose.com

Problem with retrieving slide by position from PPT document

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?

BTW, I am using the evaluation version for development purposes. I don’t know if that could be messing things up. I noticed it generates a watermark, and when generating new presentations it seems to insert empty slides with warning messages in random places.

Hi Joao,


I have tried to understand the issue shared by you. In order to reproduce the issue on my end, I may need the source code that you are using to highlight the issue. Please share the project code so that I may reproduce the issue on my end to help you out further.

Thanks and Regards,