Efficiently Merge PowerPoint Presentations (PPT, PPTX) with C#
Optimize Your Presentation Merging
With Aspose.Slides for .NET, seamlessly combine PowerPoint presentations while preserving styles, layouts, and all elements. Unlike other tools, Aspose.Slides blends presentations without compromising on quality or losing data. Merge entire presentations, specific slides, and even different file formats (PPT to PPTX, etc.).
Merging Features
- Full Presentation Merge: Assemble all slides into a single file.
- Specific Slide Merge: Choose and combine selected slides.
- Cross-Format Merge: Integrate presentations of varying formats, maintaining integrity.
Tip
Looking for a quick and free online tool to merge PowerPoint presentations? Try the Aspose PowerPoint Merger.
- Merge PowerPoint files easily: Combine multiple PPT, PPTX, ODP presentations into a single file.
- Supports different formats: Merge PPT to PPTX, PPTX to ODP, and more.
- No installation required: Works directly in your browser, fast and secure.
Start merging your PowerPoint files with Aspose free online tool today!
Presentation Merging
When you merge one presentation to another, you are effectively combining their slides in a single presentation to obtain one file.
Info
Most presentation programs (PowerPoint or OpenOffice) lack functions that allow users to combine presentations in such manner.
Aspose.Slides for .NET , however, allows you merge to presentations in different ways. You get to merge presentations with all their shapes, styles, texts, formatting, comments, animations, etc. without having to worry about loss of quality or data.
See also
What Can Be Merged
With Aspose.Slides, you can merge
- entire presentations. All the slides from the presentations end up in one presentation
- specific slides. Selected slides end up in one presentation
- presentations in one format (PPT to PPT, PPTX to PPTX, etc) and in different formats (PPT to PPTX, PPTX to ODP, etc) to one another.
Note
Besides presentations, Aspose.Slides allows you to merge other files:
- Images, such as JPG to JPG or PNG to PNG
- Documents, such as PDF to PDF or HTML to HTML
- And two different files such as image to PDF or JPG to PDF or TIFF to PDF.
Merging Options
You can apply options that determine whether
- each slide in the output presentation retains a unique style
- a specific style is used for all the slides in the output presentation.
To merge presentations, Aspose.Slides provides AddClone methods (from the ISlideCollection interface). There are several implementations of the AddClone
methods that define the presentation merging process parameters. Every Presentation object has a Slides collection, so you can call a AddClone
method from the presentation to which you want to merge slides.
The AddClone
method returns an ISlide
object, which is a clone of the source slide. The slides in an output presentation are simply a copy of the slides from the source. Therefore, you can make changes the resulting slides (for example, apply styles or formatting options or layouts) without worrying about the source presentations becoming affected.
Merge Presentations
Aspose.Slides provides the AddClone (ISlide) method that allows you to combine slides while the slides retain their layouts and styles (default parameters).
This C# code shows you how to merge presentations:
using (Presentation pres1 = new Presentation("pres1.pptx"),
pres2 = new Presentation("pres2.pptx"))
{
foreach (ISlide slide in pres2.Slides)
{
pres1.Slides.AddClone(slide);
}
pres1.Save("combined.pptx", SaveFormat.Pptx);
}
Merge Presentations with Slide Master
Aspose.Slides provides the AddClone (ISlide, IMasterSlide, Boolean) method that allows you to combine slides while applying a slide master presentation template. This way, if necessary, you get to change the style for slides in the output presentation.
This code in C# demonstrates the described operation:
using (Presentation pres1 = new Presentation("pres1.pptx"),
pres2 = new Presentation("pres2.pptx"))
{
foreach (ISlide slide in pres2.Slides)
{
pres1.Slides.AddClone(slide, pres2.Masters[0], allowCloneMissingLayout: true);
}
pres1.Save("combined.pptx", SaveFormat.Pptx);
}
Note
The slide layout for the slide master is determined automatically. When an appropriate layout can’t be determined, if theallowCloneMissingLayout
boolean parameter of the AddClone
method is set to true, the layout for the source slide is used. Otherwise, PptxEditException will be thrown.
If you want the slides in the output presentation to have a different slide layout, use the AddClone (ISlide, ILayoutSlide) method instead when merging.
Merge Specific Slides From Presentations
This C# code shows you how to select and combine specific slides from different presentations to get one output presentation:
using (Presentation pres1 = new Presentation("pres1.pptx"),
pres2 = new Presentation("pres2.pptx"))
{
foreach (ISlide slide in pres2.Slides)
{
pres1.Slides.AddClone(slide, pres2.LayoutSlides[0]);
}
pres1.Save("combined.pptx", SaveFormat.Pptx);
}
Merge Presentations With Slide Layout
This C# code shows you how to combine slides from presentations while applying your preferred slide layout to them to get one output presentation:
using (Presentation pres1 = new Presentation("pres1.pptx"),
pres2 = new Presentation("pres2.pptx"))
{
foreach (ISlide slide in pres2.Slides)
{
pres1.Slides.AddClone(slide, pres2.LayoutSlides[0]);
}
pres1.Save("combined.pptx", SaveFormat.Pptx);
}
Merge Presentations With Different Slide Sizes
Note
You cannot merge presentations with different slide sizes.To merge 2 presentations with different slide sizes, you have to resize one of the presentations to make its size match that of the other presentation.
This sample code demonstrates the described operation:
using (Presentation pres1 = new Presentation("pres1.pptx"),
pres2 = new Presentation("pres2.pptx"))
{
pres2.SlideSize.SetSize(pres1.SlideSize.Size.Width, pres1.SlideSize.Size.Height, SlideSizeScaleType.EnsureFit);
foreach (ISlide slide in pres2.Slides)
{
pres1.Slides.AddClone(slide);
}
pres1.Save("combined.pptx", SaveFormat.Pptx);
}
Merge Slides to Presentation Section
This C# code shows you how to merge a specific slide to a section in a presentation:
using (Presentation pres1 = new Presentation("pres1.pptx"),
pres2 = new Presentation("pres2.pptx"))
{
for (var index = 0; index < pres2.Slides.Count; index++)
{
ISlide slide = pres2.Slides[index];
pres1.Slides.AddClone(slide, pres1.Sections[0]);
}
pres1.Save("combined.pptx", SaveFormat.Pptx);
}
The slide is added at the end of the section.