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?

Thank's 
 Marco

5 Replies

SS Siva Subramanian Syncfusion Team July 12, 2013 12:44 PM UTC

Hi Marco,

 

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/General/GenerateWord_Web-225466537.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/documents/nestedmailmerge.htm

 

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

 

Regards,

Sivasubramanian



MA Marco July 12, 2013 01:50 PM UTC

Thank's for the reply. Unfortunately the solution it isn't exactly what i was looking for.... i try to explain better my problem:
I'm using Microsoft EntiyFramework with its lazy loading functionality. For example I can have a main class "Suppliers" and inside a Reference (or a List) to another object of type "Products".
In this case, the join query is automatically executed by the framework and at runtime I have, for example, an instance of the object "Suppliers" which has a List of "Products". This is a classic master detail relationship, managed only with objects. What I want is only a mechanism to print the master object (this is what i already did) and all the child objects contained in the respective List (this step is what i can't do).


SS Siva Subramanian Syncfusion Team July 16, 2013 06:14 AM UTC

Hi Marco,

 

Thank you for your update.

 

Currently DocIO does not have support to perform mail merge for child objects used as a reference in the master object. As we stated before, we can feed the Child objects collection as a separate mail merge data table along with commands for successful mail merge. Kindly refer the sample provided in our previous response.

 

Please let us know if you have any other questions.

 

Regards,

Sivasubramanian



JJ Jernej Jerin replied to Siva Subramanian October 3, 2014 11:36 AM UTC

Hi Marco,

 

Thank you for your update.

 

Currently DocIO does not have support to perform mail merge for child objects used as a reference in the master object. As we stated before, we can feed the Child objects collection as a separate mail merge data table along with commands for successful mail merge. Kindly refer the sample provided in our previous response.

 

Please let us know if you have any other questions.

 

Regards,

Sivasubramanian


Is this feature now supported?


AK Ayswarya Krishna Kumar Syncfusion Team December 26, 2014 10:02 AM UTC

Hi Jernej,

We appreciate your patience.

We have implemented the support to perform mail merge for child objects used as a reference in the master object and this support has been included in our 2014 Volume 4 release.
Essential Studio Vol 4, 2014 is available for download under the following link.

http://www.syncfusion.com/forums/117834/essential-studio-2014-volume-4-final-release-v12-4-0-24-available-for-download

Please refer the below UG link for more details on Nested Mail Merge.
http://help.syncfusion.com/ug/windows%20forms/#!documents/nestedmailmerge.htm

Please refer the below online sample to illustrate the same.
http://asp.syncfusion.com/demos/reporting/DocIO/Mail%20Merge/NestedMailMerge/CS/NestedMailMerge.aspx

We thank you for your support and appreciate your patience in waiting for this release. Please get in touch with us if you would require any further assistance.

Please let us know if you have any other questions.

Regards,
Ayswarya


Loader.
Live Chat Icon For mobile
Up arrow icon