Merge particular slides from different presentations into one

Can you please provide me sample code to merge some slides from different presentations into one presentation?


I have observed your comments. Can you please visit this link for more details. This will help you to achieve your requirements. Please share feedback with us if there is still an issue.

Hi Adnan,
I am not able to download the sample code from the link u gave.
Getting error “Sorry, this file is private. Only visible to topic owner and staff members.”

ps: I am using Aspose.Slides Java


I have attached the sample project for your convenience here. (72.9 KB)

Hi mudassir,
But i am trying to achieve this in Java only.
SO I am looking for java sample code to merge


Please try using following Java alternate on your end.

public static void TestClonning()
             String pptxFile = "SB1.pptx";
            String pptxResult ="C:\\Aspose Data\\Target.pptx";

            //Open file
            LoadOptions lo = new LoadOptions(LoadFormat.Pptx);
            Presentation  target = new Presentation();
            Presentation presToCopy = new Presentation(pptxFile, lo);

            //Copy slides
            for(int i=0;i<presToCopy.getSlides().size();i++)
            //Delete default slide

            //Save new file
            target.Save(pptxResult + "Result.pptx", SaveFormat.Pptx);

I have created a ppt by merging multiple ppt’s now I want to change the title texts in first slide or want to add a new title slide at the beginning. Please help me in this regard


I have observed your comments. Can you please share source file so that we may further investigate to help you out. (2.9 MB)
Hi, Please find the attached file. I want to change title or add new Title slide with same layout

Adnan, One more thing while merging two ppt’s It is not maintaining sections. if I have sections in any ppt then how can i mantain sections?


I have observed your comments. I have shared sample code with you. This will help you to achieve your requirements.

Presentation pres = new Presentation(“Adv-PowerPoint-WKSP.pptx”);
pres.getSlides().insertEmptySlide(0, pres.getMasters().get_Item(0).getLayoutSlides().get_Item(0));
IAutoShape sh = (AutoShape)pres.getSlides().get_Item(0).getShapes().get_Item(0);
sh.getTextFrame().setText(“First Slide”);“saved.pptx”, SaveFormat.Pptx);

For your above query please visit this documentation link for further details.

Hi Adnan,
Thanks for the reply.
Actually my questions are:

  1. while merging multiple ppt’s I want to maintain sections as well. My result ppt should contain sections too.
  2. what if I added a new section into the ppt using addSection() method then how can I add multiple slides into this section. I am able to add only one slide.

I need urgent help in this.


I have observed your requirements and like to share that the slide you add in addSection() method actually symbolize the start index slide for that particular section. You can continue adding slide afterwards and they shall fall in same section that you previously added. As soon as you will add a new section and add slides afterwards then they will be added inside new section. I hope the share elaboration will be helpful.

Hi mudassir,
I tried to add an empty section at index 0 so that I can add some slides into it. but getting error:

Exception in thread “main” class com.aspose.slides.PptxEditException: Index must lay within [0…Count-1] range.
com.aspose.slides.SectionCollection.addEmptySection(Unknown Source).

I am sharing my Java code with u.
please refer slideCloner (3.1 KB)

Please help me to add multiple slides into the one section or copy the section and slide from the source ppt,


I have observed your comments. A ticket with ID SLIDESJAVA-37295 has been added in our issue tracking system to resolve the issue. This thread has been associated with the ticket so that we share notification with you once issue will be fixed.

Hi Team,
Please help me to embed video into the slide.
I have a mp4 video in my filesystem how can i add it into the existing or new slide?


I suggest you to please try using the sample code given over this documentation link for your reference.

Now I am facing one more problem, video thumbnail in slide showing no Image

solved— :slight_smile:


We are glad to know that things have started working on you end.