Using two presentation master

Hi,

I've heard a lot about ASPOSE.Slides for Java and I just thought I should download the evaluation copy, I have downloaded the evaluation copy and I've started playing with it. We are using ColdFusion 8 to build for the application, if it does what we want, I'll go for it straightaway.

Simple question: Is it possible for ASPOSE.Slides to copy/choose slides from multiple presentations into a new presentaion, irrespective that there is every possibility that they will have differing Master templates? This is solely what we are looking to use it for.

Using your forum I've managed to configure CF 8 to work with it, I just wasn't sure if it'll move combine multiple slides.

Many thanks

Jedi

Dear Jedi,

Thanks for considering Aspose.Slides for JAVA.

Yes, you can import slides from different presentation into single presentation using Presentation.cloneSlide method irrespective of them having different masters.

Actually, cloneSlide method copies slide along with its master. That’s why it can also be used to import master slides.

To see code example of how to clone (import) slide from one presentation into another, please see Cloning a Slide section under the heading of Utility Features on Aspose.Slides Wiki .

There you will see code examples in JAVA, PHP, C# and VB.NET.

Thanks for your prompt reply msfaiz. After a lot of research, I bumped into Presentation.cloneSlide thanks. I seem to have hit a wall at the moment though, I converted the code from the wiki from Java to ColdFusion as laid out below, at the moment this is the error in italics

The getSlideByPosition method was not found.

Either there are no methods with the specified method name and argument types, or the getSlideByPosition method is overloaded with argument types that ColdFusion cannot decipher reliably. ColdFusion found 0 methods that matched the provided arguments. If this is a Java object and you verified that the method exists, you may need to use the javacast function to reduce ambiguity.

JAVA:

try
{
//Instantiate a Presentation object that represents a PPT file
Presentation pres1=new Presentation(new FileInputStream(new File("source.ppt")));

//Instantiate a Presentation object that represents a PPT file
Presentation pres2=new Presentation(new FileInputStream(new File("destination.ppt")));


//Accessing a slide using its slide position
Slide slide = pres1.getSlideByPosition(5);


//Creating TreeMap object that is used to store the temporary information
//about the masters of PPT file. No value should be added to it.
TreeMap tMap=new TreeMap();


//Cloning the selected slide at the end of another presentation file
pres1.cloneSlide(slide,pres1.getSlides().getLastSlidePosition() + 1,pres2,tMap);


//Writing the presentation as a PPT file
pres2.write(new FileOutputStream(new File("modified.ppt")));
}
catch(Exception ex)
{
System.out.println(ex.toString());
}

COLDFUSION:








Your help will be greatly appreciated.

Thanks,

Jedi

An updater after spending hours in trying to translate the Java code to ColdFusion, I seem to have stuck with an error that says; "An exception occurred when instantiating a Java object. The class must not be an interface or an abstract class. Error: ''. "

The error occurs as I get to pres2 in bold below, any help please


<cfset pres1 = CreateObject("java", "com.aspose.slides.Presentation").init(
fis.init("c:\test\source.ppt")) >

<cfset pres2 = CreateObject("java", "com.aspose.slides.Presentation").init(
fis.init("c:\test\destination.ppt")) >







<cfset cloneSlide = CreateObject("java","com.aspose.slides.Slide").init(
fis.init("pres1"))
>


Problem solved. It didn’t work because the destination file had empty slides. I also had to re-modify the code a bit.