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

Free Support Forum - aspose.com

RemoveUnUsedRegions not working

Hi ,

RemoveUnUsedRegions is not working on MailMergeWithRegions. I have a datatable and will populate that with rows based on an list consisiting of header and value pairs. When the list is empty ,the mergefield stays in the pdf, inspite of using RemoveUnUsedRegions .

Sample implementation:

DataTable example= new DataTable("Spec");
example.Columns.Add("Header");
example.Columns.Add("Value");
// then, i loop through the list and add rows to the dataset
// Then , i do
doc.MailMerge.ExecuteWithRegions(example);

Please suggest a way to remove the unused region.Thanks!

P.S : I am using Aspose.Words to convert a word to pdf after mailmerge

Hi Imran,

Thanks for your inquiry. Please refer to the following sections of the documentation which outlines everything you need to know about Mail Merge with Regions:

https://docs.aspose.com/words/net/types-of-mail-merge-operations/
https://docs.aspose.com/words/java/types-of-mail-merge-operations/

Regarding removing unmerged regions from a Document, please study the following article:
https://docs.aspose.com/words/net/clean-up-before-or-during-mail-merge/

In case the problem still remains, please create a simple application (for example a Console Application Project) that helps us reproduce the same problem on our end and attach it here for testing. Also, please attach your sample Word document(s) here for testing. I will investigate the issue on my side and provide you more information.

Best regards,