Free Support Forum - aspose.com

Merge particular slides from different presentations into one


#1

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


#2

@vikasgrr,

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.


#3

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


#4

@vikasgrr,

I have attached the sample project for your convenience here.

Sample_Modified.zip (72.9 KB)


#5

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


#6

@vikasgrr,

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++)
            {
                target.getSlides().addClone(presToCopy.getSlides().get_Item(i)); 
            }
            //Delete default slide
                target.getSlides().removeAt(0);

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

#7

Hi,
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


#8

@vikasgrr,

I have observed your comments. Can you please share source file so that we may further investigate to help you out.


#9

Adv-PowerPoint-WKSP.zip (2.9 MB)
Hi, Please find the attached file. I want to change title or add new Title slide with same layout


#10

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?


#11

@vikasgrr,

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”);
pres.save(“saved.pptx”, SaveFormat.Pptx);

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


#12

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.


#13

@vikasgrr,

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.


#14

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 class.src.zip (3.1 KB)

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


#15

@vikasgrr,

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.


#16

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?


#17

@vikasgrr,

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


#18

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


#19

solved— :slight_smile:


#20

@vikasgrr

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