Syncfusion Feedback

Merge PowerPoints Using Syncfusion .NET PowerPoint Library

The Syncfusion® .NET PowerPoint Library lets you merge or combine multiple PowerPoint presentations into a single presentation with just a few lines of C# code, without Microsoft PowerPoint. It also allows you to merge specific slides from one presentation into another.

Watch this video to learn how to merge multiple PowerPoint files into one using the Syncfusion .NET PowerPoint library.

Watch the video

Merge PowerPoints using C#

Learn how to merge multiple PowerPoint presentations into a single presentation programmatically using C# with the Syncfusion .NET PowerPoint Library. This guide demonstrates combining slides from different presentations into one single presentation.

Step 1: Create a new project

Start by creating a new C# Console Application project.

Step 2: Install the NuGet package

Add the Syncfusion.Presentation.Net.Core package to your project from NuGet.org.

Step 3: Add required namespaces to merge PowerPoints

Add the following namespaces to your Program.cs file:

using Syncfusion.Presentation;

Step 4: Open the source and destination PowerPoint presentations

Open both PowerPoint files that need to be merged.

Run

//Open an existing source presentation
FileStream sourceStream = new FileStream(Path.GetFullPath(@"Data/SourcePresentation.pptx"), FileMode.Open);
IPresentation sourcePresentation = Presentation.Open(sourceStream);
//Open an existing destination presentation
FileStream destinationStream = new FileStream(Path.GetFullPath(@"Data/DestinationPresentation.pptx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
IPresentation destinationPresentation = Presentation.Open(destinationStream);

Step 5: Merge the PowerPoint presentations

Clone each slide from the source presentation and add it to the destination presentation.

//Iterate each slide in source and merge to presentation
for (int i = 0; i < sourcePresentation.Slides.Count; i++)
{
    //Clone the slide of the source presentation
    ISlide clonedSlide = sourcePresentation.Slides[i].Clone();
    //Merge the cloned slide into the destination presentation
    destinationPresentation.Slides.Add(clonedSlide, PasteOptions.UseDestinationTheme, sourcePresentation);
}

Step 6: Save the PowerPoint presentation

Save the merged presentation to a file stream.

//Save the PowerPoint presentation
FileStream outputStream = new FileStream(Path.GetFullPath(@"Output/Result.pptx"), FileMode.Create);
destinationPresentation.Save(outputStream);
// Explicitly close streams and presentation
outputStream.Close();
destinationPresentation.Close();
sourcePresentation.Close();
destinationStream.Close();
sourceStream.Close();

Get started quickly by downloading the installer and checking license information on the Downloads page.

Syncfusion .NET PowerPoint Library Resources

Explore these resources for comprehensive guides, knowledge base articles, insightful blogs, and ebooks.