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

Free Support Forum - aspose.com

Exception when cloning slides

When cloning a slide that has a notes page, I get this exception:

I also get an error message when opening the presenation in Powerpoint that says

"Powerpoint was unable to display some of the text, images or objects in the file because they have become corrupted."

but the file does appear to open correctly. I can’t upload the file due to its contents. If you can’t determine the error without a file, I can try and create a sample that I can upload.

System.Web.HttpUnhandledException: Exception of type ‘System.Web.HttpUnhandledException’ was thrown. —> Aspose.Slides.PptReadException: Error clonning slide —> System.Xml.Schema.XmlSchemaException: The ‘cx’ attribute has an invalid value according to its data type.
at System.Xml.XmlValidatingReaderImpl.InternalValidationCallback(Object sender, ValidationEventArgs e)
at System.Xml.Schema.XsdValidator.ValidateStartElement()
at System.Xml.Schema.XsdValidator.ProcessElement(Object particle)
at System.Xml.Schema.XsdValidator.Validate()
at System.Xml.XmlValidatingReaderImpl.Read()
at System.Xml.XmlLoader.LoadNode(Boolean skipOverWhitespace)
at System.Xml.XmlLoader.LoadDocSequence(XmlDocument parentDoc)
at System.Xml.XmlDocument.Load(XmlReader reader)
at nb.a(rq A_0, rq A_1)
— End of inner exception stack trace —

Hi Joseph,

Thanks for considering Aspose.Slides.

In order to properly investigate the issue, we need the presentation data from you. It would be really great and helpful for us, if you could provide the problematic presentation file.

Thanks and Regards,

I could not send you the file but I determined the error was being caused by trying to draw a shape with a negative width.

AddAutoShape does not give an error when calling it with a negative width, but later trying to clone the slide does, and Powerpoint will not display a slide with such a shape.

Hi Joseph,

I have tried to reproduce the observation statement as mentioned by you i.e. creation of shape with negative width in a slide is causing exception while cloning that slide. But I have not been able to reproduce the mentioned exception.

Please use the code snippet below, in which I have created a shape with negative width and am successfully able to clone the slide. Please share some other details or source presentation. You can share your presentation by making thread conversation private. Please find the source and output presentation as well for your kind reference in attachment.

Presentation Pres_Source = new Presentation("D://ppt//Test.ppt");
Slide Sld = Pres_Source.Slides[0];

Sld.Shapes.AddRectangle(400, 55, -400, 300);

Aspose.Slides.Shape ss = Sld.Shapes[0];
int Shp_Width = ss.Width;

Pres_Source = null;

Pres_Source = new Presentation("D://ppt//asd123.ppt");
Presentation Pres_Dest = new Presentation();

System.Collections.SortedList sList = new System.Collections.SortedList();
Pres_Source.CloneSlide(Pres_Source.Slides[0], 0, Pres_Dest, sList);


Thanks and Regards,