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

DataReader and MailMerge

Hello,

I'm trying to use the overload method for MailMerge.ExecuteGroup(IDataReader) and I can't seem to get it to work... here's what I'm matching up.

Database:
TableName: Contacts
Columns: FirstName, LastName, CellNumber, JobTitle

On the Word Template (.dot) I've tried different ways of creating a MergeField to get this to work, that I have found in the examples on your website. Here are the different ways:

<>
<>
<>
<>
<>
<>

I've also tried with this:

<>
<>
<>
<>
<>
<>

Here's how I'm setting up the call in code (DataClass is a class I made to return a IDataReader which reads the above database):

IWordDocument doc = new WordDocument( @"C:\Sample Report.dot");
doc.MailMerge.ClearFields = true;
DataClass data = new DataClass();
IDataReader Contacts = data.GetContact(); doc.MailMerge.ExecuteGroup(Contacts);
doc.Save(@"C:\AfterSectionMerge.doc", FormatType.Doc);

I know I'm missing something, but can't seem to find it in the examples. I see that the examples set the table name on a datatable, but I don't believe I can do that on a IDataReader. Any ideas?

5 Replies

VS Vijayakumar S Syncfusion Team January 19, 2010 02:54 PM UTC

Hi Chris,

Thank you for your interest in Syncfusion products.

We are sorry for the delay in responding. We were able to reproduce the mentioned issue. We suspect this could be a defect. We have forwarded this issue to our development team for further analysis.

Could you please report this issue through Direct Trac Developer Support System https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents because you can take
the advantage of the expertise of a dedicated support engineer and a guaranteed response time and we hope you will take advantage of this system as well. If you have already reported, please ignore this.

Please let me know if you have any queries.

Regards,
Vijay


CL Chris Ladewig January 19, 2010 04:08 PM UTC

Looks like my tags got removed in the original post, just imagine these in the merge fields:

DataTableBegin:Contacts
FirstName
LastName
CellNumber
JobTitle
DataTableEnd:Contacts

and

BeginGroup:Contacts
FirstName
LastName
CellNumber
JobTitle
EndGroup:Contacts

Then I tried to be creative to try and get it to work:

IDataReaderBegin:Contacts
FirstName
LastName
CellNumber
JobTitle
IDataReaderEnd:Contacts



So that method isn't working? If it was how should I setup the group with MergeFields in the Word template and where do I need to set the name "Contacts" to tell the IDataReader which group to execute?

-Chris


VS Vijayakumar S Syncfusion Team January 29, 2010 07:32 AM UTC

Hi Chris,

We are sorry for the delay in responding. Please do find the sample to perform Mail merge with DataReader from the below link. Could please have a look at the sample and let us know if this helps.

Sample:
http://help.syncfusion.com/support/DocIO.Windows/samples/MailmergeWithReader.zip

Please let us know if you have any questions.

Regards,
Vijay


CL Chris Ladewig February 16, 2010 04:48 PM UTC

That helped! Thank you!


VS Vijayakumar S Syncfusion Team February 18, 2010 03:39 AM UTC

Hi Chris,

Thank you for your update.

Please let us know if you have any questions.

Regards,
Vijay

Loader.
Live Chat Icon For mobile
Up arrow icon