Thanks for your inquiry.
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.
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);