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

Free Support Forum - aspose.com

How to use Cleanup options for multiple regions using Java


document.getMailMerge().executeWithRegions(new MyDataSource("Table1"));
document.getMailMerge().executeWithRegions(new MyDataSource("Table2"));

When using the code above we noticed that option REMOVE_UNUSED_REGIONS is applied right after the first executing for "Table1". So "Table2" is completely removed and will not be rendered.

How is it possible to combine REMOVE_UNUSED_REGIONS and multiple data tables for a document?

Best regards, Evgeniy

Hi Evgeniy,

Thanks for your query. The MailMergeCleanupOptions.RemoveUnusedRegions flag will remove any region in the document which is not found in the current data source.

If you are merging data from many data sources by using separate calls to MailMerge.ExecuteWithRegions then you need to make sure that this flag is only enabled with the very last merge. Otherwise all unused regions will be removed from the document before they can be merged.




Hi Tahir,

Thanks a lot!

Best regards, Evgeniy