Coldfusion Mail Merge using query and multiple values

I’m currently evaluating aspose for word using coldfusion

Under the title " Simple Mail Merge"

How do I send multiple values of this;

<cfset values=[ "Alexey Noskov" , "Aspose" , "Auckland" ]>

To achieve multiple pages in the output document. It only allows me to send one.

Can this be done using a coldfusion query ?

@mikeraphone

Please read the following article about mail merge and check overloaded methods of MailMerge.execute. Hope this helps you.
How to Execute Mail Merge

I did check those two links out however I’m not understanding the query that is passed into the MailMerge.execute() function.

I write a simple coldfusion query and pass it in and I get an error which says:

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

I’m wondering if this function is expecting the query object to be in a certain type of format, i.e. different to what coldfusion creates.

Here is an example of my code: For testing I’ve just got two merge fields in the word document firstname and surname

select firstname, surname from member objDoc = CreateObject("java", "com.aspose.words.Document").init("/www/memberletter.docx"); objDoc.getMailMerge().execute(qMember); objDoc.save('/www/#createUUID()#.doc');

If I use the following syntax it works ok though I would like the data to come from a DB query;

objDoc = CreateObject("java", "com.aspose.words.Document").init("/www/membertletter.docx"); mergeFieldNames = ["firstname","surname"]; mergeFieldValues = ["Mary","Smith"]; objDoc.getMailMerge().execute(mergeFieldNames,mergeFieldValues);

Any help you could give me would be great.

All my script tags got truncated, let me know if you need any explanation.

https://cffiddle.org/app/file?filepath=96c9df15-6fe6-4b73-85d4-a120c13e4514/2de90e21-c620-4bdc-8c47-f13a7da1471b/50cd9f7b-a49d-4d15-843c-4ab68c8ffa57.cfm

You can view it here.

Merging Data from a ResultSet

In Aspose.Words a ResultSet object produced from a database query is passed to the mail merge engine by first wrapping it in a new instance of the DataTable class. The DataTable constructor accepts a ResultSet object and also the name of the table as a string.

Regarding the above. Is it expecting a Coldfusion query to be wrapped ina . DataTable class. How do I achieve this ?

@mikeraphone

We are working over your query and will get back to you soon.

@mikeraphone

In your case, you need to use the MailMerge.execute(com.aspose.words.net.System.Data.DataTable table) method. Please check the last example in the following article.
ColdFusion and Aspose.Words for Java