Free Support Forum - aspose.com

Cloning Slides

hello,


I followed the online example for cloning slides, however, I get the following exception at the write function - System.NullReferenceException - {“Object reference not set to an instance of an object.”}

I’ll get the same exception if I use the Save function… is there something I’m missing?

Cloning
a slide and positioning it to the end of the presentation

//Instantiate PresentationEx class that represents a PPTX file

PresentationEx pres = new PresentationEx("d:\\pptx\\helloworld.pptx");

//Clone the desired slide to the end of the collection of slides in the same PPTX

SlidesEx slds = pres.Slides;

slds.AddClone(pres.Slides[0]);

//Write the modified pptx to disk

pres.Write("d:\\pptx\\helloworld_cloned.pptx"); // <>>


please advice.

Hi Trinh,

Thanks for your growing interest in Aspose.Slides.

I have observed the code snippet shared by you and I feel that the code snippet is fine. Please share your presentation file, so that we can further investigate and resolve the specified issue.

We are sorry for your inconvenience,

Hello Mudassir,


Make sure the slide you are cloning contain a native PowerPoint 2007 chart. This is when the exception occurs. If the slides contain images, tables, media files, text boxes, or sound files… it seems to work perfectly. But if the slide has a chart, it will fail each time.

Please advise, as I would be cloning slides with charts, 90% of the time.

thanks


Hi Trinh,

I would request you to please kindly share the sample presentation for which the exception is being raised. The graphs can be added in the presentations using Aspose.Cells or can be added in excel files and then added as OLE object frames in the presentation generated by Aspose.Slides for .NET.

We are sorry for your inconvenience,