Mail Merge - Remove Empty Lines

Hello there,

Because mail merge field value could be NULL/EMPTY, I want to remove any empty lines that occurs due to this. I tried using

MailMerge.RemoveEmptyParagraphs = true;

It helped in some way, but problem is not solved completely.
For case when I have more than one Merge Fields in same line, and all the fields in that line are NULL/EMPTY, it does not remove that empty line.

For your reference, I have attached my source and output document.
(In output document, the block in red color shows the issue.)

Thank you!

Hi Nutan,
Thanks for your inquiry.
I suppose you are replacing the tags in your document with mergefields before merging? Most likely there is a space or control character left behind causing what looks like an empty paragraph not to be removed. It would be good if you could attach the generated document filled with mergefields to confirm this.
To avoid this happening please try using the solution from this post here.
Thanks,

Hi

Thanks for your request. When you specify MailMerge.RemoveEmptyParagraphs option just empty paragraphs will be removed during mail merge process. If the paragraph contains at least one character (like white space) this paragraph will not be removed. So it seems the reason of your problem is white space between fields. To fix the problem just remove this space.
Please see the attached screenshot.
Best regards,

Hello Adam,

Thanks for your reply.

Yes, you are right, I am replacing the tags with Merge Fields before executing mail merge.
I tried with the solution in the post you suggested
https://forum.aspose.com/t/77469
and it’s working fine for now.

Btw, when you say in that post:
Yes I think that the paragraphs should be removed
even when there is a trailing space. I have logged this issue, it will
be fixed sometime in the future. We will inform you as soon as this fix
is ready.

Can you please guide when Aspose is planning to introduce this fix?

Thank you

Hello Nutan,

Thanks for your inquiry. Unfortunately, it is difficult to provide you any reliable estimate regarding this feature at the moment. You will be notified as soon as it is resolved.
Best regards,

The issues you have found earlier (filed as WORDSNET-4364) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(4)