Free Support Forum - aspose.com

Removing blank lines in a mail merge

First I would like to congratulate you on a great product.

My question is this. Is it possible to remove blank lines from a mail merge? I could do it in my dataset, but it would be nicer if the word macro feature worked. I tried it, and it all went wrong, so I was just wondering before I change my select criteria, does the { IF { MERGEFIELD Address2 }.... syntax work?

Cheers

Have you tried using MailMerge.DeleteFields method?

This method removes MERGEFIELD and NEXT fields from the document.

It is useful if your mail merge operation does not always need to populate all fields in the document. Use this method to remove all remaining mail merge fields.

Yes, I do that. But it still leaves blank lines in addresses where the second or third line is a null.

Not to worry, I'll fix it with CASE ELSE statements in my query.