I have a set of Java Code that I'm trying to convert to CF. The Java class is
installed fine in the CF lib folder as a jar file, I've used all sort of method
in the code so I know the jar file is fine. At the moment I'm getting the error
below.
"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."
please see below the Java code:
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());
}
See below the CF code:
<cfobject action="create" type="java" class="com.aspose.slides.Presentation"
name="pres">
<!--- Create the object and initialize --->
<cfset x=pres.init()>
<cfset pres1 =CreateObject("java",
"java.io.FileOutputStream").init("c:\test\source.ppt")>
<cfset pres2 =CreateObject("java",
"java.io.FileOutputStream").init("c:\test\destination.ppt")>
<cfset Slide = pres1.getSlideByPosition(5)>
<cfset tmap = TreeMap()>
<cfset pres1.cloneSlide(slide,pres1.getSlides().getLastSlidePosition() +
1,pres2,tMap)>
<cfset FileOutput = CreateObject("java",
"java.io.FileOutputStream").init("c:\test\modified.ppt")>
<cfset pres2.write(FileOutput)>
<cfset FileOutput.close()>
Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293501
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4