We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Nested MailMerge with Plain Objects

Hi, I've the following two classes:

public class T1
    public int SupplierID { get; set; }    
    public T2 T2 { get; set; }
    public T1() 
        T2 = new T2();
        T2.IO = "XXX";

public class T2 
    public string IO { get; set; }

Inside my report, I want to display a List of T1 instances. So I did it in this way:
List<T1> list = new List<T1>();
foreach(...){T1 t1 = new T1(); list.Add(t1);}
document.MailMerge.ExecuteGroup(new MailMergeDataTable("Suppliers", list));

The MailMerge operation works perfectly and the property SupplierID of T1 is correctly filled. 
What i can't do instead, is to show the property IO of T2 instace. 
More precisely, T1 -> T2 -> IO (T1.T2.IO). I see few examples of nested MailMergeField, but I can't do anything with objects, it works only with SQL query. 
Does exists a method to print public Properties of referenced objects likes my example?


1 Reply

SV Sivasubramani V Syncfusion Team July 12, 2013 01:12 PM UTC

Hi Manuel,


Thank you for your interest in Syncfusion products.


We have prepared a sample to meet your requirement to use plain objects for performing nested mail merge using DocIO. Please find the same from below link:


Sample link: 



In the above sample, we have modified the code to perform nested mail merge successfully by feeding T1 and T2 instance collection as a separate mail merge data table (as MailMergeDataSet) along with command array to specify the relation.



For successful mail merge, the property name of the object must be equal to the name of the field in the word document.


For more information on nested mail merge, refer below UG links:



Kindly try the sample and let us know if this helps you.




Live Chat Icon For mobile
Up arrow icon