Hi Naidu,
I have observed the sample code shared by you but unfortunately cannot use that in my environment. However, I have worked over your requirements and have simplified the sample code and has enabled it to merge N presentations. Please remember that at any given time only slides from one presentation can be copied to another and it is a sequential approach. However, I have made an approach with which you will pass all presentation files to a function call only once and get a merged presentation with slides from N presentations.Please find the attached sample code for your kind reference. I have only modified the Aspose.Slides related portion in the files and have commented the old code that is now replaced with new one. As far as your question regarding point 1 in your query, I have not been able to understand. Can you please share more details about it. Is it related to Aspose.Slides or some limitation on your end. If it is related to Aspose.Slides, you are more than welcome to share the details regarding point 1 and I will try my best to answer that.
Many Thanks,
hi
Hi sir,
Hi Naidu,
I have observed the image shared by you and like to share that for the requirement mentioned in your point 1, you need to copy the complete path+file name given in browse field to array list. In the sample code that I modified for you by using your class I just added the presentation paths that were given in Presentation() constructor to ArrayList. You need to copy the copy the complete content of Browse field to ArrayList. The ArrayList will hold N presentation path+ file names.
For your second point, I like to share that the following method that I have shared with you in my previous post is capable of merging N presentations together. It traverse through every item in ArrayList which is a path+file name of a valid presentation and copy the slides to target presentation.
public static Presentation getClonedPres( java.util.List list)
{
Presentation srcPres=null;
Presentation targetPres=new Presentation();
for(int a=0;a<list.size();a++)
{
srcPres=new Presentation(list.get(a).toString());
com.aspose.slides.Collections.SortedList sList=new com.aspose.slides.Collections.SortedList();
for (int i = 1; i <= srcPres.getSlides().getLastSlidePosition(); i++)
{
Slide srcSlide = srcPres.getSlideByPosition(i);
srcPres.cloneSlide(srcSlide, targetPres.getSlides().getLastSlidePosition() + 1, targetPres, sList);
}
}
return targetPres;
}
I hope this will be helpful. Please share, if I may help you further in this regard.
Many Thanks,
hi sir,
Hi Naidu,
I like to share that you need to add the path string with file name to ArrayList. The User String in your code has the path+file name in it. So, based on your code that you have shared earlier, you need only to pass the string to array list as under.
java.util.List list=new java.util.ArrayList();
list.add( user);
list.add(pass);
list.add(user1);
list.add(pass1);
Please share, if I may help you further in this regard.
Many Thanks,
Hi sir,
{
Presentation srcPres=null;
Presentation targetPres=new Presentation();
for(int a=0;a<list.size();a++)
{
srcPres=new Presentation(list.get(a).toString());
com.aspose.slides.Collections.SortedList sList=new com.aspose.slides.Collections.SortedList();
for (int i = 1; i <= srcPres.getSlides().getLastSlidePosition(); i++)
{
Slide srcSlide = srcPres.getSlideByPosition(i);
srcPres.cloneSlide(srcSlide, targetPres.getSlides().getLastSlidePosition() + 1, targetPres, sList);
}
}
return targetPres;
}This method is for .ppts </span>
Hi Naidu,
Please try using the following sample code to serve the purpose. Please share, if I may help you further in this regard.
public static PresentationEx getClonedPres( java.util.List list)
{
PresentationEx srcPres=null;
PresentationEx targetPres=new PresentationEx();
SlideExCollection targetSlides=targetPres.getSlides();
for(int a=0;a<list.size();a++)
{
srcPres=new PresentationEx(list.get(a).toString());
for (int i = 0; i <= srcPres.getSlides().size(); i++)
{
SlideEx srcSlide = srcPres.getSlides().get_Item(i);
targetSlides.addClone(srcSlide);
}
}
return targetPres;
}
Many Thanks,
Hi,
Hi Naidu,
I have observed that you have been using Aspose.Slides for Java 2.6.0 in your sample project, which is fairly old version. I have tailored the code on my end using Aspose.Slides for Java 8.1.0 and it is working perfectly fine. I have changed the paths in the attached project as per my machine so you may please update them as per your environment. Please share, if I may help you further in this regard.
Many Thanks,
Hi Naidu,
Hi Mudassir Fayyaz,
Hi
Hi Naidu,
I have worked with the sample project shared by you and like to share that it is the same old project that you have shared earlier and I have shared the updated project for that in my last post. I have modified the project again and have shared that again for your kind reference. You are using old legacy API and I request you to please use Aspose.Slides for Java 8.1.0 on your end. Please refer to info.png for your kind reference. Please also visit this web link for your kind reference as well for SecurityException you are having. It seems that you are referencing two API versions of Aspose.Slides for Java in your application, which is wrong. Please use the attached sample code as it is and only check the file paths as per your environments only.
Many Thanks,
Which is the jar for PresentationEx. I cant find it in Aspose-slides 17.6. Have I used the wrong jar?
@hrishikesh.chikhale,
I like to share that PresentationEx class that you are referring belongs to legacy API that has been phased out since 2014. I suggest you to please try using latest Aspose.Slides for Java 17.6 that has Presentation class for loading the presentation. I suggest you to please visit this documentation link for latest sample codes to explore different API features.
Many Thanks,
Mudassir Fayyaz