Problem with mergefields

If i do have a template with merge fields in different lines. Let say i ahve 6 mergefields in 6 continuous lines wihtout any data around them, then when the data is merged to produce a word document,
if the merge field data is empty, those field lines are being empty, they got to be removed , right,

I am attaching teh template, and alos the output word document.

When the value from teh databae is null, then i am making it “” .
SO in the place of mergefileds, the space is staying like that, and you can see the output file with lot os white spaces. To ignore that, what to do?.


Thanks for your inquiry. I think that you can use RemoveEmptyParagraphs property to solve this problem. For example see the following code.

Document doc = new Document(@"417_106189_raviteja\in.doc");
string[] names = { "test" };
string[] values = { "" };
doc.MailMerge.RemoveEmptyParagraphs = true;
doc.MailMerge.Execute(names, values);

Best regards.