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

Free Support Forum - aspose.com

How to populate merge filed using String[] rather than ResultSet?

I am populating merge field using

doc.getMailMerge().executeWithRegions("Exe-Tab-Info ",rs);

In word document i am using

«TableStart:Exe-Tab-Info» «THIS»


but in one column in Exe-Tab-Info region i want to populate with String[] how can it be possible?

is there any way to populate merge filed with String[].

pls help me out.

Thanks in advance.


Thanks for your request. I think that you can use MergeField event to achieve this. For example here is C# code that achieves this.

public void TestMailMerge_100716()


Document doc = new Document(@"318_100716_pveeranki\in.doc");

string[] arr = { "test", "test", "test" };

string[] names = { "Field1" };

object[] values = { arr };

doc.MailMerge.MergeField += new MergeFieldEventHandler(MailMerge_MergeField_100716);

doc.MailMerge.Execute(names, values);



void MailMerge_MergeField_100716(object sender, MergeFieldEventArgs e)


if (e.FieldName == "Field1")


string text = string.Empty;

string[] arr = (string[])e.FieldValue;

for (int i = 0; i < arr.Length; i++)


text += arr[i] + "\n";


e.Text = text;



You can find information about using MergeField event in JAVA here

I hope that this will help you.

Best regards.