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

Free Support Forum - aspose.com

How to use Multiple CleanupOptions

Hello,


I’m having some trouble trying to get NEXTIF to work as expected. I’m using NEXTIF inside my template to skip a record inside of a Region.

I’m using the following syntax:
{TableStart group}
{ NEXTIF { MERGEFIELD property } <> “SomeString” }

… Other mergefields, Word table, …

{TableEnd group}

However, after the NEXTIF has done it’s job all the other mergefields, template defined tables etc… Still get outputted instead of being omitted.

Another question I have is how to define mutiple CleanupOptions in Java?
doc.getMailMerge().setCleanupOptions() takes an int so I presume I can let it take mutiple cleanupoptions by adding them in like so:

doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_UNUSED_REGIONS + MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);

Thanks

Hi Bart,

Thanks for your inquiry.

bvr:

However, after the NEXTIF has done it’s job all the other mergefields, template defined tables etc… Still get outputted instead of being omitted.

Could you please attach your input/output Word document here for testing? I will investigate the issue on my side and provide you more information.

bvr:

Another question I have is how to define multiple CleanupOptions in Java?

You can use the multiple cleanup options as shown in following code snippet.

doc.getMailMerge().setCleanupOptions(MailMergeCleanupOptions.REMOVE_EMPTY_PARAGRAPHS |MailMergeCleanupOptions.REMOVE_UNUSED_REGIONS |MailMergeCleanupOptions.REMOVE_UNUSED_FIELDS);