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

Free Support Forum - aspose.com

Values from Database for Merge fields

I have three merge fields ( first name, last name and middle name) in my word template. And these megre fields are in different places like first name in starting row, last name at end of the signature.

I got the result set which contains only one row by executing "select first_name,last_name,middle_name from emp" query.

so how to merge these values into merge fields.

Thanks.

Hi Prashanth,

Thanks for your inquiry. In your case, I suggest you please use MailMerge.execute method to perform mail merge from a DataTable into the document.

Data which comes from a ResultSet (the result of a database query) is wrapped into an Aspose.Words class called DataTable . Many DataTable objects can be added to a DataSet. These classes mimic the basic functionality of DataTable and DataSet in .NET and allow to more easily merge complex hieratical data into documents. Please read following documentation links for your kind reference.
http://www.aspose.com/docs/display/wordsjava/About+Mail+Merge+in+Aspose.Words
http://www.aspose.com/docs/display/wordsjava/How+to++Execute+Simple+Mail+Merge