Merge Presentations

This demo uses the DevExpress Presentation API to merge multiple presentations into a single file. You can merge predefined sample files or supply your own documents. To do the latter, select Upload a File in the file selection drop-down menu and upload files one at a time.

Use the Merge and Save as... dropdown button to select the output format, merge presentations, and download the result.

Sample document
Sample_first.pptx
Sample_second.pptx



using DevExpress.Docs.Presentation;

Stream MergePresentations(List<Stream> inputStreams, DocumentFormat targetFormat, bool pdfOutput) {
    var outputStream = new MemoryStream();

    if(inputStreams.Count > 0) {
        using var presentation = new Presentation(inputStreams[0]);
        for(int i = 1; i < inputStreams.Count; i++) {
            var inputStream = inputStreams[i];
            using var tempPresentation = new Presentation(inputStream);
            foreach(var slide in tempPresentation.Slides)
                presentation.Slides.Add(slide);
        }
        if(pdfOutput)
            presentation.ExportToPdf(outputStream);
        else
            presentation.SaveDocument(outputStream, targetFormat);
    }

    outputStream.Position = 0;
    return outputStream;
}