Merge and Combine PowerPoint PPT/PPTX Presentations in C#

How to Merge and Combine PowerPoint PPT/PPTX Presentations in C#
Merge and Combine PowerPoint PPT/PPTX Presentations in C#

As a C# developer, you may need to merge multiple PPT or PPTX files into one programmatically. Copying and pasting the one PowerPoint content to other is time consuming task while combining PowerPoint slides or merging parts of a single presentation. Therefore, in this article I will demonstrate how to merge and combine PowerPoint PPT/PPTX presentations in C#.

The following topics shall be covered in this article:

PowerPoint Merger REST API and C# SDK

In order to merge PowerPoint files, I will be using .NET SDK of GroupDocs.Merger Cloud API. It is a secure, reliable and high-performance Cloud SDK to merge several documents into one and to split a single file into multiple documents. It also offers functionality to reorder or replace document pages, change pages orientation, manage document passwords and perform other manipulations easily for any supported file format. Currently, it supports JavaPHPRubyAndroid, and Node.js SDKs as its document merger family members for the Cloud API.

You can install GroupDocs.Merger-Cloud to your Visual Studio project from the NuGet Package manager or using the following command in the .NET CLI:

dotnet add package GroupDocs.Merger-Cloud --version 22.5.0

Next, get your Client ID and Client Secret from the dashboard before you start following the steps and available code examples. Add Client ID and Client Secret in the code as demonstrated below:

Merge Multiple PPT/PPTX Files into One in C# using REST API

You can combine two or more PowerPoint files or merge specific slides of PPTX by following the simple steps mentioned below:

  • Upload the PPTX files to the Cloud
  • Merge the uploaded PPT or PPTX files
  • Download the merged slides

Upload the PowerPoint File

Firstly, upload the PowerPoint PPTX documents to the Cloud using any of the following methods:

  • Using the dashboard
  • Upload all files one by one using Upload File API from the browser
  • Upload programmatically using the code example given below:

As the result, PowerPoint PPTX file will be uploaded to the Cloud Storage.

Combine Multiple PowerPoints into One

Now, you can merge multiple PowerPoint files programmatically on the cloud. It is a secure and fast way to merge multiple PPTX documents into a single file programmatically by following the steps mentioned below:

  • Create an instance of the DocumentApi
  • Create an instance of the JoinItem
  • Set the input file path for first JoinItem in the FileInfo
  • Create new instance of the JoinItem for the second PPTX document
  • Provide the input file path for second JoinItem in the FileInfo
  • Add more JoinItems to merge more PPTX files
  • Create an instance of the JoinOptions
  • Add a comma separated list of created join items
  • Set the output file path on the cloud
  • Create an instance of the JoinRequest with JoinOptions
  • Get results by calling the join() method of the DocumentAPI with JoinRequest

The following code snippet shows how to merge multiple PowerPoint files in C# using REST API:

Input Files

You can see the input PowerPoint files in the image below:

How to merge PowerPoint presentations online
Merge two power point presentations

Output File

You can see the output in the image below:

How to merge multiple ppt files into one in C#
Combine Multiple PowerPoints into One

Download the Merged File

The above code example will save the merged PPTX file on the cloud. You can download it using the following code snippet:

Merge Specific Slides of Multiple PowerPoint Files in C#

You can easily combine specific pages from multiple PowerPoint slides into a single file programmatically by following the steps mentioned below:

  • Create an instance of the DocumentApi
  • Create an instance of the JoinItem
  • Set the input file path for first JoinItem in the FileInfo
  • Define a list of page numbers to be merged
  • Create another instance of the JoinItem
  • Set the input file path for second JoinItem in the FileInfo
  • Define start page number and end page number
  • Define the page range mode as OddPages
  • Create an instance of the JoinOptions
  • Add a comma separated list of created join items
  • Set the output file path on the cloud
  • Create an instance of the JoinRequest with JoinOptions
  • Finally, merge slides by calling the join() method of the DocumentAPI with JoinRequest

The following code snippet shows how to merge specific pages from multiple PowerPoint files using REST API in C#:

Combine PowerPoint Presentations in C# using Slides Range

You can combine multiple PowerPoint slides into one file using slides range mode programmatically by following the steps mentioned below:

  • Create an instance of the DocumentApi
  • Create an instance of the JoinItem
  • Set the input file path for first JoinItem in the FileInfo
  • Create another instance of the JoinItem
  • Set the input file path for second JoinItem in the FileInfo
  • Define start page number and end page number
  • Define the page range mode as OddPages
  • Create an instance of the JoinOptions
  • Add a comma separated list of created join items
  • Set the output file path on the cloud
  • Create an instance of the JoinRequest with JoinOptions
  • Finally, merge slides by calling the join() method of the DocumentAPI with JoinRequest

The following code snippet shows how to merge range of pages from multiple PowerPoint files in C# using REST API:

Online Combine PowerPoint Presentations

How to merge PowerPoint files into one online free? Please try the following free online PPTX Merger application to combine multiple PowerPoint presentations into a single file from any device.

Summing up

In this blog post, you have learned:

  • how to combine multiple PowerPoint files on the cloud;
  • programmatically upload the PowerPoint file and then download the merged PPTX file from the cloud;
  • how to combine specific pages of multiple PowerPoint files into a single file;
  • how to combine range of pages of multiple PowerPoint files into one file;
  • online merge PowerPoint presentations for free;

Additionally, you can learn more about GroupDocs.Merge Cloud API using the documentation. We also provide an API Reference section that lets you visualize and interact with our APIs directly through the browser. Complete source code of GroupDocs.Merger Cloud SDK for .Net is freely available on the GitHub.

Ask a question

For any queries about how to combine multiple PPT or PPTX files, please feel free to ask in Free Support Forum.

FAQ

  • How to merge PPT files into one in C#?

Please follow this link to learn the C# code snippet for how to combine PowerPoint slides from different files quickly and easily.

  • How to combine several PowerPoints into one quickly using REST API?

Create an instance of DocumentApi, set the input files path, create JoinOptions instance and invoke the documentApi.Join() method with JoinRequest to automatically merge PowerPoint files quickly.

  • How to install online PPT merger library?

You can download and install PPT merger API to process, and merge PowerPoint presentations programmatically.

  • How to merge PowerPoint slides online free?

Please visit PPT merger free to merge pptx online quickly, in seconds.

  • how to combine multiple PowerPoints into one online free?

Open our online PPTX merger
Click inside the file drop area to upload PowerPoint files or drag & drop PowerPoint files.
Click on Merge Now button, PPT merger app will combine all PowerPoints into one.
Download link of output file will be available instantly after merging PPTX files online.

  • How to merge PowerPoint presentations on Windows?

Please visit this link to merge PPT free. This free PPTX merger app will merge ppt slides in windows with a single click.

How to combine multiple PowerPoints into one
How to merge PPT slides without changing format

See Also