Question

Aleksandra Vinokikj on Wed, 26 Apr 2017 15:10:45


Hi there,

I'm using OpenXML and OpenXMl Power Tools for combining multiple pptx files into a single files. But sometimes slides in the built presentation are not same as original ones. The elements on them are enlarged or reduced.

Example of reduced elements on slide #2:https://1drv.ms/i/s!Ag1kK3U84USSjlAaC4xYxjoVxpj-

Here is how it looks like if the slides are merged in different order (elements on slide #2 are enlarged): https://1drv.ms/i/s!Ag1kK3U84USSjk_3pp9Zu4QFXpWt

I'm using the following code in order to merge the slides into one file:

 var slides = new List<OpenXmlPowerTools.SlideSource>();

foreach (var slidePath in slidePaths)
     slides.Add(new OpenXmlPowerTools.SlideSource(new OpenXmlPowerTools.PmlDocument(slidePath), true));

OpenXmlPowerTools.PresentationBuilder.BuildPresentation(slides, presentationPath);

Where, slidePaths is List of physical paths of the slides need to be combined, and presentationPath is the path where the new file should be saved.

Does anyone know why is this happening and how this can be fixed?

P.S. Following are the links for downloading the slides: 

  • https://1drv.ms/p/s!Ag1kK3U84USSjk3up5tJsLmh_ZDQ
  • https://1drv.ms/f/s!Ag1kK3U84USSjk6by8XOkAWsjIMN

Thanks in Advance,

Aleksandra



Sponsored



Replies

Deepak Panchal10 on Thu, 27 Apr 2017 05:38:57


Hi Aleksandra Vinokikj,

you are using OpenXMl Power Tools.

which is combination of Powershell and Open XML.

we only provide support for Open XML on this forum.

so we are not sure for your issue.

if you are able to only use Open XML then I can suggest you a code then you can try to refer to merge the presentations using Open XML.

private void MergePresentation(string sourcePresentation, string mergedPresentation)
{
    int id = 0;

    // Open the destination presentation.
    using (PresentationDocument myDestDeck = PresentationDocument.Open(mergedPresentation, true))
    {
        PresentationPart destPresPart = myDestDeck.PresentationPart;

        // If the merged presentation does not have a SlideIdList 
        // element yet, add it.
        if (destPresPart.Presentation.SlideIdList == null)
            destPresPart.Presentation.SlideIdList = new SlideIdList();

For full code and steps to run this code you can visit link below.

Merge PowerPoint Presentations (PPTX) & save as PDF

Regards

Deepak