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

MailMerge NullReferenceException

Hi,

I'm using the simple MailMerge example of your help pages (where I replaced Template.docx through my own template file). The given fieldNames do exist in the word template. 

WordDocument document = new WordDocument(filename);
string[] fieldNames = new string[] { "Emp_Id", "Name", "Phone", "City" };
string[] fieldValues = new string[] { "1001", "Peter", "+122-2222222", "London" };

//Performs the mail merge.
document.MailMerge.Execute(fieldNames, fieldValues);

//Saves and closes the WordDocument instance
document.Save("Sample.docx", FormatType.Docx);
document.Close();
I'm getting a NullReferenceException at the "Execute" statement (StackTrace: "at Syncfusion.DocIO.DLS.WField.UpdateFieldRange()"). Is there a bug or am I doing something wrong?
Best wishes
Gernot

3 Replies

AK Ayswarya Krishna Kumar Syncfusion Team November 11, 2015 08:22 AM UTC

Hi Gernot,

Thank you for using Syncfusion product.

We are unable to reproduce the mentioned ‘Null Reference Exception in UpdateFieldRange()’ method of WField class. We have tested the given scenario with 13.3.0.7 public version assemblies. For your reference, we have attached the sample which we have tried to reproduce the issue at our end. Kindly modify the sample to reproduce the mentioned Exception issue in UpdateFieldRange() at our end and also please provide us template document you have used for performing MailMerge operation which causes the issue, so that we could analyze further and update you with more appropriate details on the mentioned issue.

Please, find the sample from the following link.

Sample link:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/DocIO_UWP-573470430.zip

Please let us know if you have any questions.

Regards,
Ayswarya



GG Gernot Gutschi December 20, 2015 08:37 PM UTC

Hi,

if I use your example and the attached Word file, I get the mentioned exception.

I also have another question (not sure if I should start a new thread for it):
Is mail merge with groups not supported in UWP?

Regards,
Gernot

Attachment: template.merge_3ac2a109.rar


SV Sarathkumar V Syncfusion Team December 21, 2015 10:22 AM UTC

Hi Gernot,

We have created a support incident for the reported Null reference exception issue while performing mail merge using DocIO under your account.
Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Regards,
Sarath


Loader.
Live Chat Icon For mobile
Up arrow icon