In various cases, you may need to split the PowerPoint presentations into multiple files. For example, to split a presentation by each slide, even or odd slides, and so on. In this article, you will learn how to split the PowerPoint PPTX/PPT presentations using C#.
.NET API to Split PowerPoint Presentations
In order to split PPTX or PPT presentations, we will use Aspose.Slides for .NET. It is a presentation manipulation API that lets you create, modify and convert PowerPoint and OpenOffice presentations from within your .NET applications. You can either download the API or install it using NuGet.
PM> Install-Package Aspose.Slides.NET
Split a PowerPoint Presentation using C#
The following are the steps to split a PowerPoint presentation using C#.
- First, create an instance of the Presentation class to load the PowerPoint presentation.
- Then, loop through each ISlide in Presentation.Slides collection.
- In each iteration, perform the following steps:
- Create an instance of Presentation class.
- Remove the default slide using Presentation.Slides[0].Remove() method.
- Add the slide to the presentation using Presentation.Slides.AddClone(ISlide) method.
- Finally, save the presentation using Presentation.Save(String, SaveFormat) method.
The following code sample shows how to split a PowerPoint PPTX presentation.
Get a Free API License
You can use Aspose.Slides for .NET without evaluation limitations by requesting a temporary license.
Online Demo
Try the online presentation splitter, which is based on Aspose.Slides.
Conclusion
In this article, you have learned how to split PowerPoint PPTX or PPT presentations using C#. You can customize the provided code sample to define your own splitting criteria. For example, you can split each slide in the presentation, all the even or odd slides, etc. You can simply install the API and integrate the provided code into your application. In addition, you can visit the documentation to explore other features of API. Also, you can feel free to let us know about your queries via our forum.