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

Free Support Forum - aspose.com

Getting an Empty Slide result from CloneSlide() method (C# .NET)

Hi all. I’m working with Visual Studio 2003, and working in Visual Basic. For some reason, I’m having trouble duplicating one particular slide using Clone Slide. Below are the slides and the code I’m calling from an .aspx page. I’d appreciate any ideas on what could be causing this problem:

source.ppt - This 3-slide powerpoint is defined in the code, and all three slides are cloned into a new file. Slide 2 does not clone correctly though. - http://www.virtualfactory.com/source.ppt

blank.ppt - A simple 1-slide powerpoint with no contents and default settings - http://www.virtualfactory.com/blank.ppt

new.ppt - This is the result when I run it through the code below. The second slide does not come through - http://www.virtualfactory.com/new.ppt

Again, any help would really be appreciated.

Here’s the code: (also available at http://www.virtualfactory.com/cloneCode.txt )

Imports System.Data.OleDb
Imports System.Collections

Imports Aspose.Slides

Public Class clone
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
Private Sub InitializeComponent()

End Sub

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Public Sub RunClone()
Dim SourcePresentation As Presentation = New Presentation(“D:\source.ppt”)
Dim DestPresentation As Presentation = New Presentation(“D:\blank.ppt”)

Dim sList As SortedList = New SortedList

Dim Slide1 As Slide = SourcePresentation.GetSlideByPosition(1)
Dim Slide2 As Slide = SourcePresentation.GetSlideByPosition(2)
Dim Slide3 As Slide = SourcePresentation.GetSlideByPosition(3)

SourcePresentation.CloneSlide(Slide1, DestPresentation.Slides.LastSlidePosition + 1, DestPresentation, sList)
SourcePresentation.CloneSlide(Slide2, DestPresentation.Slides.LastSlidePosition + 1, DestPresentation, sList)
SourcePresentation.CloneSlide(Slide3, DestPresentation.Slides.LastSlidePosition + 1, DestPresentation, sList)



Response.Write(“Finished Processing”)
End Sub

End Class

First of all, there is something wrong with source.ppt file.
I could open it with PP2003 with SP2, but couldn’t without SP2.
Also I compared second slides in source.ppt and new.ppt and don’t see any differencies.

You're right, that on PP2003, there's no difference. But I can open the source and see the second slide with no problem in PP2000 sp3. I can also copy and paste the slide in PP2000 with no trouble.

It's only when I use Aspose.slides to clone the slide that it comes up blank in new.ppt.

Does Aspose.slides not support PP2000?

Oh, I see. Yes, Aspose.Slides supports PP2000 but sometimes such problems can happen.
Unfortunately, that’s too hard to find why it doesn’t work and I can’t promise to publish hot fix soon.
Really, that is very rare thing now and I think source slide is broken because PP2003 can’t read it too.


I think this may be the same problem I just encountered.

Try removing the AutoShape Arcs (curved arrows) from the slide that cannot be cloned.

Good Luck,
Randy Stegbauer


Using latest Aspose.Slides for .NET 20.7 API, now you can conveniently copy the slides between different presentation and also with in same presentation. Please try using following example to serve the purpose on your end.

// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_Slides_Presentations_CRUD();

// Instantiate Presentation class to load the source presentation file
using (Presentation srcPres = new Presentation(dataDir + "CloneAtEndOfAnother.pptx"))
    // Instantiate Presentation class for destination PPTX (where slide is to be cloned)
    using (Presentation destPres = new Presentation())
        // Clone the desired slide from the source presentation to the end of the collection of slides in destination presentation
        ISlideCollection slds = destPres.Slides;


        // Write the destination presentation to disk
        destPres.Save(dataDir + "Aspose2_out.pptx", SaveFormat.Pptx);