I did a search and could not find a post related to this. I am using Coldfusion 8 and having some problem with the method ‘executeWithRegions’.This is my code:
I got the following error while running the above code:
Error: The executeWithRegions method was not found.
Detail: Either there are no methods with the specified method name and argument types, or the executeWithRegions 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.
Perhaps you’re using an older version of Aspose.Words; I would suggest you please upgrade to the latest version of Aspose.Words. You can download it from the following link: https://releases.aspose.com/words/java
Thanks for the reply. I updated the jdk file but still could not get it to work. I followed the instruction on how to do the regions in Coldfusion, but my question is do I really have to create the .jar file to get the dataset? If I am not mistaken the cfquery already returns the result set, so I can use the cfquery as the parameter in the executeWithRegions method. Also how many parameters should be passed to the executeWithRegions method? In the Coldfusion example (https://docs.aspose.com/words/java/coldfusion-and-aspose-words-for-java/) it passes two parameters but in the documentation (https://reference.aspose.com/words/java/com.aspose.words/MailMerge) it only accepts one parameter. Can anyone help me on this?
The ColdFusion example in the documentation is not according to latest version of Aspose.Words for Java. We will update this code example as soon as possible. We apologize for your inconvenience.
In your case, you may pass DataTable or DataSet object to executeWithRegions method to achieve your requirements. Please create a separate Java class for MailMerge with some methods which returns DataTable/DataSet object. The executeWithRegions take parameter of type com.aspose.words.DataTable/com.aspose.words.DataSet which cfquery do not return.
Following Java code example shows the detail of com.aspose.words.DataTable.
public void mailMergeImageFromBlob() throws Exception
{
Document doc = new Document(getMyDir() + "MailMerge.MergeImage.doc");
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Loads the driver
// Open the database connection.
String connString = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};" +
"DBQ=" + getDatabaseDir() + "Northwind.mdb" + ";UID=Admin";
// DSN-less DB connection.
java.sql.Connection conn = java.sql.DriverManager.getConnection(connString);
// Create and execute a command.
java.sql.Statement statement = conn.createStatement();
java.sql.ResultSet resultSet = statement.executeQuery("SELECT * FROM Employees");
com.aspose.words.DataTable table = new com.aspose.words.DataTable(resultSet, "Employees");
// Perform mail merge.
doc.getMailMerge().executeWithRegions(table);
// Close the database.
conn.close();
doc.save(getMyDir() + "MailMerge.MergeImage Out.doc");
}
Hope this answers your query. Please let us know if you have any more queries.