We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge fields stay in the generated document when table contains no rows

After migrating from old Aspose.Words to I have a problem with populating tables. I have a row and in the first cell I have TableStart:TableName merge field and in the last cell I have TableEnd:TableName merge field. If TableName contains rows then the table is populated. However, if there are no rows in TableName then the merge fields stay in the generated document. I would like the table not to contain any rows and not to show the merge fields.

I tried to find some setting that I could change and I tried:
_doc.MailMergeSettings.DoNotSupressBlankLines = False

with no luck.
What do I need to change to get rid of those merge fields?

I found it…

_doc.MailMerge.CleanupOptions = MailMergeCleanupOptions.RemoveUnusedFields Or MailMergeCleanupOptions.RemoveUnusedRegions

Hi Michal,

Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input template Word document.
  • Aspose.Words 14.7.0 generated output document which shows the undesired behavior.
  • Aspose.Words 14.3.0 generated output document which showing desired behavior.
  • Please create a standalone (runnable) console application that helps us reproduce your problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information.

Best regards,