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

Free Support Forum - aspose.com

How do I copy all shapes on a slide to another slide in a diffrent presentation?

I want to copy all shapes on slide SourceSlide to slide TargetSlide (I can reposition them manually).

TargetSlide already has data on it - I want to append everything from SourceSlide onto TargetSlide. What is the best way to do this?

Dear smartapp,

Thank you for using Aspose.Slides,

One easy way to copy shape from one slide into another is to serialize the shape in source slide and add the shape in the shape collection of target slide. e.g.

//serialize the shape into memory stream from source slide

MemoryStream ms = new MemoryStream();

shp.Serialize(ms);

ms.Position = 0;

//Add the shape from stream into the shape collections of destination/target slide

Shape dstShape = dstSlide.Shapes.Add(ms);

Thanks a lot for your fast responce. Your solution worked perfectly.

Hello msfaiz,

Your sample code is very interesting, I've tried it to serialize a chart coming from the Dundas chart library and it successed.

But the same code failed when I've tried to serialize a simple table, from an other slide.

The exception message is :

" Aspose.Slides.PptException : Shape is abstract class and can't be serialized."

The execution code is :

Dim PRESENTATION_TEMPLATE As Aspose.Slides.Presentation = New Aspose.Slides.Presentation("c:\TEMPLATE.PPT")

Dim PRESENTATION_RAPPORT_1 As Aspose.Slides.Presentation = New Aspose.Slides.Presentation("c:\RAPPORT1.PPT")

Dim SLIDE_RAPPORT_1 As Aspose.Slides.Slide = PRESENTATION_RAPPORT_1.Slides.Item(0)

Dim NOUVELLE_SLIDE_1 As Aspose.Slides.Slide = PRESENTATION_TEMPLATE.AddBodySlide()

Dim FLUX As System.IO.Stream = New System.IO.MemoryStream

Try
SLIDE_RAPPORT_1.Shapes(0).Serialize(FLUX)
FLUX.Position = 0
NOUVELLE_SLIDE_1.Shapes.Add(FLUX)
PRESENTATION_TEMPLATE.Write("c:\Rapport final.PPT")

Catch ex As Exception

Console.WriteLine(ex.ToString)

End Try

Is it possible to copy a table from a slide to an other slide, with the serialize method, or it's necessary to rebuild the table by getting the properties from the first table ?

Thank you very much.

Mathias.

You cannot serialize any group shape at the moment. Table is also a group shape. The only way to move all the shapes is Presentaiton.CloneSlide method.

Serializing the group shape is in our new feature request and will be implemented soon within next three to four weeks.

Thank you very much for your support.

I'm going to use your method in a first way, before your the next release.

I was looking for this feature of copying serialized Tables using latest version (2.9.2.0) and it still hasn’t been implemented. Any chance for this?

It is still months late because of lot investigation and work involved.