---
title: "Merge PowerPoint presentations in C#"
url: https://recursiveai.org/onedocument/cookbook/merge-powerpoint-slides/
description: "Merge PowerPoint presentations in C# with OneDocument. Append slides, keep source formatting or use destination layouts, and inspect the merge report."
version: "1.0.0"
---

# Merge PowerPoint presentations in C#

**OneDocument** is a free, open-source Word, Excel and PowerPoint document library for .NET from Recursive AI. MIT or Apache-2.0, no native dependencies.

[NuGet](https://www.nuget.org/packages/RecursiveAI.OneDocument.Presentations) · [GitHub](https://github.com/recursive-ai-oss/onedocument-csharp) · [Docs](https://recursiveai.org/onedocument/docs/) · [Download example (.zip)](https://recursiveai.org/onedocument/cookbook/merge-powerpoint-slides/merge-powerpoint-slides.zip)

Append slides from one PowerPoint deck to another. The zip includes first.pptx (“Quarterly review”) and second.pptx (“Regional results”), each with one title slide.

```shell
dotnet add package RecursiveAI.OneDocument.Presentations
```

Requires [.NET 10](https://dotnet.microsoft.com/download/dotnet/10.0) (net10.0); .NET 9 and earlier aren’t supported.

```csharp
using RecursiveAI.OneDocument.Presentations;

using var target = Presentation.Open("first.pptx");
using var source = Presentation.Open("second.pptx");
target.InsertSlides(source.Slides);
target.SaveAs("merged.pptx");
```

Writes merged.pptx with two slides; the snippet prints nothing. Each slide keeps its source master and layout, which supply its theme and arrangement of placeholders.

Unzip [the example](https://recursiveai.org/onedocument/cookbook/merge-powerpoint-slides/merge-powerpoint-slides.zip), then `dotnet run`.

## The full program

The full program also prints the resulting slide count and each resolution, problem and loss in the merge report.

```csharp
using RecursiveAI.OneDocument.Presentations;

using var target = Presentation.Open("first.pptx");
using var source = Presentation.Open("second.pptx");
var result = target.InsertSlides(source.Slides);
target.SaveAs("merged.pptx");
Console.WriteLine($"Slides: {target.Slides.Count}");
foreach (var item in result.Report.Resolutions)
    Console.WriteLine(item.Code);
foreach (var item in result.Report.Problems)
    Console.WriteLine(item.Code);
foreach (var item in result.Report.Loss.Items)
    Console.WriteLine(item.Code);
```

`dotnet run` prints:

```text
Slides: 2
merge.master-reused
```

Check the merge report: inserted slides lose comments, and shapes are not scaled when the decks have different slide sizes.

## Variations

**Insert at the beginning using destination layouts.**

```csharp
using RecursiveAI.OneDocument.Presentations;
using RecursiveAI.OneDocument.Operations;

using var target = Presentation.Open("first.pptx");
using var source = Presentation.Open("second.pptx");
var result = target.InsertSlides(source.Slides, 0,
    new SlideInsertOptions {
        Formatting = SlideFormatting.UseDestination
    });
target.SaveAs("destination-style.pptx");
foreach (var item in result.Report.Resolutions)
    Console.WriteLine(item.Code);
```

Writes destination-style.pptx and prints `merge.layout-mapped`.

**Merge several decks in order.**

This uses the same first.pptx and second.pptx inputs included in the zip. Add more paths to the array for more decks.

```csharp
using RecursiveAI.OneDocument.Presentations;

using var target = Presentation.Create();
foreach (string path in new[] { "first.pptx", "second.pptx" })
{
    using var source = Presentation.Open(path);
    target.InsertSlides(source.Slides);
}
target.SaveAs("combined.pptx");
Console.WriteLine($"Slides: {target.Slides.Count}");
```

Writes combined.pptx and prints `Slides: 2`.

## Related recipes

- [Convert PowerPoint to PDF](https://recursiveai.org/onedocument/cookbook/convert-pptx-to-pdf/)
- [Extract text from Office files](https://recursiveai.org/onedocument/cookbook/extract-text-from-office-files/)

## The short answer

Use `Presentation.InsertSlides` to copy a source deck’s slides into the destination, then save the destination as a new PPTX. Omitting the insertion index appends the slides. The default keeps source formatting; use the merge report to see what was reused, copied or lost.

## Where can I find a C# example that merges PowerPoint presentations?

The downloadable console project merges two included, generated presentations. The first contains a title slide reading “Quarterly review”; the second contains a title slide reading “Regional results”. The output contains them in that order.

The full program captures the return value of `InsertSlides`. Its `Report.Resolutions` describes decisions such as master reuse. `Report.Problems` and `Report.Loss` describe content that could not be carried over. Read all three rather than treating a successful save as an assurance of complete fidelity. The included decks share identical masters, so this run reports `merge.master-reused`.

With the default `SlideFormatting.KeepSource`, an identical master is reused only when the master markup, theme bytes and layouts match under the library’s comparison. Otherwise the source master, all its layouts and its theme are copied. This preserves the source slide’s formatting relationship rather than forcing every slide into the destination’s theme. The [presentation merge documentation](https://recursiveai.org/onedocument/docs/operations-merge/) defines that comparison and the report codes.

The variation instead selects `UseDestination` and insertion index 0. It places the source slide before the destination’s existing slide. Layout mapping looks for the same layout name, then the same layout type, then falls back to the first layout. That is a different operation from retaining the source master, so decide which appearance you need before choosing it.

Related parts have their own rules. The slide and parts only it uses are copied, including pictures, charts with embedded workbooks, diagrams, objects and tags. Notes pages are copied only when the destination has a notes master; otherwise the report records `merge.notes-dropped`. Comments are not copied. A link to another slide points to the slide itself, so inspect navigation in a deck that relies on cross-slide links.

If slide sizes differ, shapes are not scaled to fit, and the report records `merge.slide-size`. For a workflow that accepts arbitrary uploaded presentations, make matching slide dimensions a condition of your input process or review the merged layout afterward. Keeping source formatting alone does not solve a size mismatch.

## Can I merge PowerPoint presentations in C# for free?

Yes. The Presentations package is free and open source under MIT or Apache-2.0. The example uses .NET 10 and the published 1.0.0 package. It runs as a console application without launching PowerPoint or sending either deck to a hosted merge service.

Both presentation objects stay open during insertion because the operation reads source slides and their related parts while editing the destination. Save to a separate filename, as the example does, when you want to retain the originals. For more inputs, insert each deck’s slides into the same destination in the intended order, checking each operation’s report before accepting the final file.
