1. Home
  2. /
  3. GroupDocs.Merger.LowCode
  4. /
  5. Developer Guide
  6. /
  7. Merge PPTX (JoinPptx)

Using JoinPptx to Merge PPTX Documents

This topic shows how to use the JoinPptx plugin to merge PowerPoint presentations in the PPTX format. JoinPptx takes a source PPTX document and appends other PPTX documents to it, in the order you list them.

Prerequisites

Refer to the Developer Guide to learn how to set up your environment and run the code examples in this section.

The Loading Source Documents and Saving Output Documents topics explain how to specify input and output documents.

Basic Example

The following example appends a 6-slide deck to a 7-slide deck. The presentations are loaded from the current folder, and the merged presentation is saved to the output folder.

using System;
using GroupDocs.Merger.Domain.Options;
using GroupDocs.Merger.LowCode;

// Load license keys
var publicKey = Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");
var privateKey = Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");

// Apply the license
License.Set(publicKey, privateKey);

// Append the documents to the source document
var merger = new JoinPptx("deck-1.pptx", new[] { "deck-2.pptx" }, new JoinOptions());

// Save the merged document
merger.Save("output/merged-deck.pptx");
Imports System
Imports GroupDocs.Merger.Domain.Options
Imports GroupDocs.Merger.LowCode

Module Program
    Sub Main()
        ' Load license keys
        Dim publicKey = Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")
        Dim privateKey = Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")

        ' Apply the license
        License.Set(publicKey, privateKey)

        ' Append the documents to the source document
        Dim merger As New JoinPptx("deck-1.pptx", {"deck-2.pptx"}, New JoinOptions())

        ' Save the merged document
        merger.Save("output/merged-deck.pptx")
    End Sub
End Module
open System
open GroupDocs.Merger.Domain.Options
open GroupDocs.Merger.LowCode

[<EntryPoint>]
let main _ =
    // Load license keys
    let publicKey = Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")
    let privateKey = Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")

    // Apply the license
    License.Set(publicKey, privateKey)

    // Append the documents to the source document
    let merger = JoinPptx("deck-1.pptx", [ "deck-2.pptx" ], JoinOptions())

    // Save the merged document
    merger.Save("output/merged-deck.pptx")
    0

Sample input: Download deck-1.pptx

Sample input: Download deck-2.pptx

Expected output: Download merged-deck.pptx (13 slides)

Merge PPTX Documents from a Stream

The source presentation can also be a Stream; the presentations to append are always file paths. The stream is read from the beginning, and it stays open after Save.

using System;
using System.IO;
using GroupDocs.Merger.Domain.Options;
using GroupDocs.Merger.LowCode;

// Load license keys
var publicKey = Environment.GetEnvironmentVariable("GD_PUBLIC_KEY");
var privateKey = Environment.GetEnvironmentVariable("GD_PRIVATE_KEY");

// Apply the license
License.Set(publicKey, privateKey);

// Open the source document as a stream
using var stream = File.OpenRead("deck-1.pptx");

// Append the documents to the source document
var merger = new JoinPptx(stream, new[] { "deck-2.pptx" }, new JoinOptions());

// Save the merged document
merger.Save("output/merged-deck.pptx");
Imports System
Imports System.IO
Imports GroupDocs.Merger.Domain.Options
Imports GroupDocs.Merger.LowCode

Module Program
    Sub Main()
        ' Load license keys
        Dim publicKey = Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")
        Dim privateKey = Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")

        ' Apply the license
        License.Set(publicKey, privateKey)

        ' Open the source document as a stream
        Using stream = File.OpenRead("deck-1.pptx")
            ' Append the documents to the source document
            Dim merger As New JoinPptx(stream, {"deck-2.pptx"}, New JoinOptions())

            ' Save the merged document
            merger.Save("output/merged-deck.pptx")
        End Using
    End Sub
End Module
open System
open System.IO
open GroupDocs.Merger.Domain.Options
open GroupDocs.Merger.LowCode

[<EntryPoint>]
let main _ =
    // Load license keys
    let publicKey = Environment.GetEnvironmentVariable("GD_PUBLIC_KEY")
    let privateKey = Environment.GetEnvironmentVariable("GD_PRIVATE_KEY")

    // Apply the license
    License.Set(publicKey, privateKey)

    // Open the source document as a stream
    use stream = File.OpenRead("deck-1.pptx")

    // Append the documents to the source document
    let merger = JoinPptx(stream, [ "deck-2.pptx" ], JoinOptions())

    // Save the merged document
    merger.Save("output/merged-deck.pptx")
    0

Sample input: Download deck-1.pptx

Sample input: Download deck-2.pptx

Expected output: Download merged-deck.pptx (13 slides)