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

Free Support Forum - aspose.com

Using Aspose.Words for mailmerge with ColdFusion 9

I have downloaded the 30 day eval and am evaluating this product to replace our office automation using word for mail merges, I am a cold fusion programmer and am having a hard time understanding how to perform a mailmerge with a data set, I can successfully create a simple 1 page doc using the 1st example here:
https://docs.aspose.com/words/net/platforms-and-interoperability/
Can anyone provide a simple example e.g. say the above 1st CF example, mailmerging a handful of fullname, company, city …I can do it with an array, xml file, coldfusion datasource, whatever will work.
Our ultimate goal is to be able to mailmerge into a word document information from a database and using that same database then merge into a word document which would be avery labels. Which is what we are using our current server side office automation for.

As an update, what it looks like I really need is some way to execute the Get_Mailmerge referenced in the 1st example with a query object or xml object of some sort as it appears the array method only allows for merging 1 set of data per document (fine with letters, but not for labels). I can successfully create a single document per results of a query with that first example by creating the arrays and calling the Get_MailMerge method , however this will not work with labels e.g. the attached labels.doc

I may have some followup that may help you help me :slight_smile: …someone helped me in putting together an xml datasource, however I am getting an error when I try to run doc.Get_MailMerge().Execute(customerTable) with this (the last line in the code below), the “” line does indeed show me a record of type query with the data loaded up from the XML file created from the coldfusion cfquery — hopefully this assists you in assisting me!! – oh and doc is a properly created object in the code, this works fine with the string array call i.e.

Hi there,

Thanks for your inquiry. Please check the overloaded method of MailMerge.Execute from here:
https://reference.aspose.com/words/net/aspose.words.mailmerging/mailmerge/execute/

In your case, I suggest you to create a wrapper class in C#/VB.NET and use it in your ColdFusion code. Please see the following example for your kind reference. Hope this helps you.

namespace AsposeComWrapper
{
    public class Methods
    {
        public Methods()
        {}

        public void MailMerge_Test(object inPath, object outPath)

        {
            Document doc = new Document((string) inPath);

            DataTable dt = new DataTable("TableName");
            dt.Columns.Add("Column1", typeof(string));
            dt.Rows.Add("value 1");
            dt.Rows.Add("value 2");

            doc.MailMerge.Execute(dt);


            doc.Save((string) outPath, saveOptions);
        }
    }
}

I switched to you java components and all works now!

Hi there,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.