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

Free Support Forum - aspose.com

Applying Slide Master (ppt)

Hi,

I am currently working with the most recent trial version of Aspose slides (7.6) with the view of upgrading from Aspose (2.2). I am trying to perform the process of applying a slide master. The process is however not succeeding. It is resulting in a functional powerpoint (.ppt) file without any master slide applied. In the extracts below variables.ppt refers to variables.ppt = createObject(“Java”, “com.aspose.slides.Presentation”).init(); in the constructore class.

This solution is being written in CF10 with the java version 1.7.0_15.

Hope you can help.

I am not being presented with an error on attempting this.

Regards,

Jarlath

try{
presFile = createObject(“Java”, “java.io.FileInputStream”).init(JavaCast(“string”, arguments.filePath));
masterTemplate = createObject(“Java”, “com.aspose.slides.Presentation”).init(presFile);
sld = createObject(“Java”, “com.aspose.slides.Slide”);
masterSlide = createObject(“Java”, “com.aspose.slides.Slide”);
mstrID = “”;
normSlide = “”;
i = 0;
tm = createObject(“Java”, “java.util.TreeMap”).init();
lenSlides = 0;
sld = masterTemplate.cloneSlide(masterTemplate.getSlideByPosition(1),1, variables.ppt, tm);
mstrID = sld.getMasterId();
variables.ppt.getSlides().remove(sld);
masterSlide = variables.ppt.getSlideById(mstrID);
lenSlides = variables.ppt.getSlides().getLastSlidePosition();
presFile.close();
}catch (any e){
/*
If we are here an issue with the file exists and we should log this before returning
out of the code to allow execution of the remainder of the code to continue
/
return;
}

for(i=1; i lte lenSlides; i=i+1){
try {
normSlide = createObject(“Java”, “com.aspose.slides.Slide”);
normSlide = variables.ppt.getSlideByPosition(i);
normSlide.changeMaster(masterSlide, JavaCast(“boolean”, “true”));
} catch (any e){
/

If we are here an issue with the action to apply the master file
exists and we should log this before returning out of the code to
allow execution of the remainder of the code to continue
*/
return;
}
}

May be an issue with the use of java.util.treemap in CF10…

Hi Jarlath,

Thanks for getting back to us. I have observe the sample code and description shared by you. I like to share that from Aspose.Slides for Java 3.0.0, we no more use java.util.TreeMap for cloning slides in PPT. You now need to use com.aspose.slides.Collections.SortedList instead of TreeMap to serve the purpose. Please visit this documentation link for your kind reference as well and share with us if there is still an issue.

Many Thanks,

Hi Mudassir,

Thank you for replying earlier.

Sadly at the moment we are confined to using Aspose 2.2 with CF10. I am attempting to add a slide master which has a rectangle containing text and an image with a link. This text and image is grouped in 1 object. When i make attempt to apply the slide master i am getting "Slide cloning error."

I will attach a version of the ppt i am trying to use when applying a master template. It would be great if you could help me source the issue we may have with this template.

We did initially use the same approach on CF8 with actionscript and the functionality worked. Is it likely the underlying java libraries are causing issue?

Regards,

Jarlath

Hi Jarlath,


I have observed the comments shared by you and suggest you to please give a try to Aspose.Slides for Java 7.6.0. Actually, the support is provided on the basis of latest availble product version. If your issue is resovled in Aspose.Slides for Java 7.6.0 then I will offer you to please use the specified version. If there is still an issue with latest version then I may add the ticket for you in our issue tracking system.

Many Thanks,