We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Slides 7.5.1 hangs up during cloning a presentation

Hello,

Aspose.Slides 7.5.1 hangs up during cloning a presentation.
Presentation is attached.

Java stack trace:
at java.lang.Class.isAssignableFrom(Native Method)
at com.aspose.slides.pf4dd765c.pf4dd765c.pf4dd765c.pbdb106a0.a.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.t.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.t.if(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.i.do(Unknown Source)
at com.aspose.slides.pf4dd765c.pbdb106a0.i.if(Unknown Source)
at com.aspose.slides.Collections.SortedList.do(Unknown Source)
at com.aspose.slides.Collections.SortedList.do(Unknown Source)
at com.aspose.slides.Collections.SortedList.set_Item(Unknown Source)
at com.aspose.slides.SlideUtil.do(Unknown Source)
at com.aspose.slides.SlideUtil.do(Unknown Source)
at com.aspose.slides.SlideUtil.do(Unknown Source)
at com.aspose.slides.SlideUtil.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.if(Unknown Source)
at com.aspose.slides.MainMaster.do(Unknown Source)
at com.aspose.slides.Presentation.do(Unknown Source)
at com.aspose.slides.Presentation.cloneSlide(Unknown Source)
at com.dhl.its.ipresent.client.datasource.commons.service.PresentationServiceImpl.appendSlides(PresentationServiceImpl.java:27)


Java code:
final Presentation destination = new Presentation();
final Presentation source = new Presentation(“C:\sample.ppt”);

final SortedList ids = new SortedList();
for (int pos = source.getFirstSlideNumber(); pos <= source.getSlides().getLastSlidePosition(); pos++) {
ids.clear();
source.cloneSlide(source.getSlideByPosition(pos), pos, destination, ids);
}

final Slide empty = destination.getSlideByPosition(destination.getSlides().getLastSlidePosition());
destination.getSlides().remove(empty);

destination.write(“C:\result.ppt”);

Maybe this note will help you:
when we used Aspose.Slides version 2.4.2, with the same Java code, it worked well for this presentation.

Hi Mihai,


Thanks for inquiring Aspose.Slides.

I have observed the code sample shared and worked with that using Aspose.Slides for Java 7.5.1 and JDK 1.6_45 installed in Windows 7 x64. I have not been able to observe the issue on my end using the sample code shared by you. There is one logical mistake that I have found in your code is that on cloning every slide you are clearing sorted list. The sorted list object holds valid as long as you are cloning slides from same presentation. The moment, you select slides from another presentation, you will re-instantiate sorted list object. Please use the following sample code to serve the purpose.

public static void PPTClone()
{
String path=“D:\Aspose Data\”;
final Presentation destination = new Presentation();
final Presentation source = new Presentation(path+“sample.ppt”);

final com.aspose.slides.Collections.SortedList ids = new com.aspose.slides.Collections.SortedList();
for (int pos = source.getFirstSlideNumber(); pos <= source.getSlides().getLastSlidePosition(); pos++)
{
//You dont need this
// ids.clear();
source.cloneSlide(source.getSlideByPosition(pos), pos, destination, ids);
}

final Slide empty = destination.getSlideByPosition(destination.getSlides().getLastSlidePosition());
destination.getSlides().remove(empty);

destination.write(path+“result.ppt”);
}

Please share the complete environment, JDK and Operating system details with us if the issue still arise with using above mentioned code on your end.

Many Thanks,

Mudassir,

Thanks for this hint, it helped. However this code was previously provided by you in this thread:
<a href="


So we would like you to confirm that disabling the “ids.clear()” function, will not impact or bring back old defect.

Thanks in advance !

Hi Mihai,

I guess you are referring to this link:
https://forum.aspose.com/t/shapes-get-corrupted-when-just-splitting-into-slides/85427 for your query. I have tried this on my end, if ids.clear() is not commented, the cloned presentation size grew to 64 Mb. You can comment the line and if there is any issue you are always welcome to share and we will try our best to address that.

Many Thanks,