This short tutorial briefs about the process of how to merge slides in C#. It has all the details about the resources required to set the IDE for development, a list of programming tasks describing the program logic, and a runnable sample code to merge PPTX in C#. You will also learn the process to filter slides while merging them from different presentations.
Steps to Merge PowerPoint Files in C#
- Set the IDE to use Aspose.Slides for .NET to merge slides
- Load the source presentation using the Presentation class
- Load target presentations as much as required in separate Presentation class objects
- Iterate through all the slides in the target presentations in a loop
- Call the AddClone() method of the slides collection of the source presentation where other presentations are to be combined
- Save the resultant presentation on disk having all the slides from the target presentations
These steps summarize the process to combine PowerPoint files in C#. The process is initiated by loading the first presentation file where all the slides from other presentations will be appended followed by loading all other presentations from which slides will be added to the desired presentation. Afterward, all the slides of the target presentations are iterated and AddClone() method in the slides’ collection of the source presentation is called to append them.
Code to Combine Slides in C#
This code demonstrates the process to combine multiple PowerPoints into one in C#. There are multiple overloaded methods for the AddClone() where you may provide the LayoutSlide to be used for the inserted slide, provide a section for the new slide, and even provide a master slide for the newly added slide. Moreover, you may filter the slides by checking the slide name or slide id using the Name and SlideId property respectively in the target slide.
This article has taught us to merge PowerPoint presentations in C#. If you are interested in learning the process to add a video to a presentation, refer to the article on how to add video in presentation using C#.