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

Building an Object Source MailMerge

Thread ID:





96382 Sep 9,2010 04:44 AM UTC Sep 13,2010 07:30 AM UTC WPF 1
Tags: DocIO
Larry Kloepping
Asked On September 9, 2010 04:44 AM UTC

We have built some helper functions that allow us to reflect on objects using a dot notation. For example we can use something like "Person.Address.City" to retrieve the city for a name. Essentially this is a Person class that has an Address class with the Address class containing a property called "City". By naming my merge fields in a word document using this syntax it's easy to iterate through the merge fields and then get the data using MailMerge.Execute with a list of merge fields and data. The problem I'm running into is with do the same sort of thing with Group merging. For example suppose we had a "Person.Addresses[n].City.Population" This would mean we had a person with multiple addresses and want to return all the population for the cities. I would create a mailmerge . I manually create a datatable from the addresses collection and pass it to MailMerge.ExecuteGroup. If I just use it would return the default City string representation, but when I use it doesn't work. I even tried attaching an event handler to the merge to manually handle this case, but the event it not fired since the merge can not find . Any ideas on how i might handle this?

Rajendran [Syncfusion]
Replied On September 13, 2010 07:30 AM UTC

Hi Larry,

Thank you for using Syncfusion products.

The following must be ensured for mail merge process to work properly.
1. The merge field name and the column name should be the same.
2. Otherwise you have to map the merge fields with the column names.
Code Snippet for Mapping Fields:
//Update the mapping fields
document.MailMerge.MappedFields.Add("CompanyAddress", "Address");

We have prepared a sample to illustrate your requirement. Please do find the sample from below location.

Sample link:

Please try this and if the problem persists, Could you please update your sample for further analysis?

Please let us know if you have any other questions.



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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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