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

Free Support Forum - aspose.com

Merging of slides

Hi support,

I switch the Aspose.Slides libary from version 16.3 to 18.2.1.
Now I do get an error, if I try to merge 2 presentations.

Here is the example code:
string pptxFile = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, “SB1.pptx”);
string pptxResult = System.AppDomain.CurrentDomain.BaseDirectory;

        //Open file
        Aspose.Slides.LoadOptions lo = new Aspose.Slides.LoadOptions(Aspose.Slides.LoadFormat.Pptx);
        Aspose.Slides.Presentation  masterpptx = new Aspose.Slides.Presentation(pptxFile, lo);

        //Delete slides
        while (masterpptx.Slides.Count > 0)
            masterpptx.Slides.RemoveAt(0);

        Aspose.Slides.Presentation presToCopy = new Aspose.Slides.Presentation(pptxFile, lo);

        //Copy slides
        masterpptx.Slides.AddClone(presToCopy.Slides[0]); // Null reference error happens!!!

        //Save new file
        masterpptx.Save(pptxResult + "Result.pptx", Aspose.Slides.Export.SaveFormat.Pptx);

PFA the sample solution for VS 2013.
Sample.zip (76.9 KB)

Best regards
Christoph

@kriki,

I have observed the issue shared by you and suggest you to please try using following sample code on your end to serve the purpose. Actually, you need to delete the unused slides after cloning on your end.

Sample_Modified.zip (72.9 KB)