Free Support Forum - aspose.com

Merge 2 or more PowerPoints

Hi Alex.

I need to merge 2 or more PP - do you have any plans to implement this? Or, will I be able to do this when you have implemented the “Add Slide” ?

Have a nice day “down under” from Denmark.

Dear edc110,

What you think about overloaded Clone function? Is it enough for you for the first time? I can do it in short time.

public Slide CloneSlide(Slide srcSlide, int position, Presentation dstPresentation);

Later (after implementing “Add Slide”) we are planning to make export and import from XML so it will be possible to export separate slides to XML and import it to another presentation.

Hi.

If you implement “overloaded Clone function” as you described would realy help a lot - Any idea the time-frame?

Best regards

Monday or Tuesday. Is it ok for you? I’d like to finish links at first.

Yes - it is fine. Looking forward to try it.

Dear edc110,

You can try it. Please check new hot fix 1.2.4.0.

Hi.

I have now tested your hot fix 1.2.4.0 - regarding merge PowerPoints. But I can’t make it work.

What am I doing wrong?

Here is my code

---------------------------------------------------------------------------

'/////////////////////////////////////////////////////////////////////////

'/ Copyright 2002-2004 Aspose Pty Ltd. All Rights Reserved.

'/

'/ This file is part of Aspose.PowerPoint. The source code in this file

'/ is only intended as a supplement to the documentation, and is provided

'/ “as is”, without warranty of any kind, either expressed or implied.

'/////////////////////////////////////////////////////////////////////////

Imports System

Imports System.IO

Imports Aspose.PowerPoint

Module Template

'This demo shows how to use existing presentation as template

'for creating new presentations.

'Use demo.ppt file from Documents folder.

Dim Part1PowerPoint As Presentation

Dim Part2PowerPoint As Presentation

Sub Main()

'Dim currentDir As String = System.IO.Directory.GetCurrentDirectory()

'Dim licenseFile As String = currentDir + “\Aspose.PowerPoint.lic”

'PowerPoint.SetLicense(licenseFile)

Dim Part1PowerPointFile As String = “C:\Aspose\Part_1.ppt”

Dim Part2PowerPointFile As String = “C:\Aspose\Part_2.ppt”

Dim OutputPowerPoint As String = “C:\Aspose\Result.ppt”

Dim fis As System.IO.FileStream = New System.IO.FileStream(Part1PowerPointFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)

Part1PowerPoint = New Presentation(fis)

fis.Close()

Dim fis2 As System.IO.FileStream = New System.IO.FileStream(Part2PowerPointFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)

Part2PowerPoint = New Presentation(fis2)

fis2.Close()

Call PowerPointMerger(Part1PowerPoint, Part2PowerPoint)

Dim fout As System.IO.FileStream = New System.IO.FileStream(OutputPowerPoint, System.IO.FileMode.Create, System.IO.FileAccess.Write)

Part1PowerPoint.Write(fout)

fout.Flush()

fout.Close()

End Sub

Private Sub PowerPointMerger(ByRef dstPresentation As Presentation, ByRef srcPresentation As Presentation)

Dim DestSlideId As Integer = dstPresentation.Slides.Count

Dim srcSlide As Slides = srcPresentation.Slides

Dim i As Integer

Try

For i = 0 To srcSlide.Count - 1 Step i + 1

dstPresentation.CloneSlide(srcSlide(i), DestSlideId + i, dstPresentation)

Next

Catch ex As System.Exception

System.Console.WriteLine(ex.Message)

End Try

End Sub

End Module

Dear edc110,

Did you try to delete “Step i + 1” statement?

Thank you for the code. It looks like I need review all VB code in the demos.

By the way, I think it’s more simple to use:

Part1PowerPoint = New Presentation(Part1PowerPointFile)

instead of:

Dim fis As System.IO.FileStream = New System.IO.FileStream(Part1PowerPointFile, System.IO.FileMode.Open, System.IO.FileAccess.Read)
Part1PowerPoint = New Presentation(fis)
fis.Close()

Hi

I have used your methode, but my application keeps casting an exception.

My part2-Powerpoint have a master dias and 2 slides. Each slide containing one image. If you want I can send you my PP.

Regards
EDC110

Dear edc110,

Yes, your PP will be very helpful.
I changed internal structure of data in 1.2.4 for better performance and
for more simple adding new features but now it is not stable when reads text frames.
I’m fixing it now.

Hi Alex.

Did you get my email with the PP I am using in my test?

Regards
edc110

Dear edc110,

Sure, I got it. Thank you very much.
Please install new 1.2.5 hot fix and read my comments about pictures.
It’s not possible to implement adding pictures to the empty presentation in a short time yet.