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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Nested MailMerge with Plain Objects

Thread ID:

Created:

Updated:

Platform:

Replies:

109919 Jul 10,2013 09:30 PM UTC Jul 12,2013 01:12 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: DocIO
Marco
Asked On July 10, 2013 09:30 PM UTC

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?

Thank's 
 Marco

Sivasubramani V [Syncfusion]
Replied On 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: 

http://www.syncfusion.com/downloads/Support/DirectTrac/110591/GenerateWord_Web1956663918.zip

 

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.

 

Note:

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:

http://help.syncfusion.com/ug/asp.net/docio/default.htm#!documents/nestedmailmerge.htm

 

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

 

Regards,

Sivasubramani.V


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;