Ignoring or removing unwanted merge fields from a template


#1

Hi Roman,

I was wondering if there is any functionality to igonore or remove unmatched mergefields from the template at runtime when using mailmerge.executewithregions functionality.

We have mergefields in the template which may or may not exist in the XML, depending on whether the user specifies they are to be used.

Currently if a mergefield does not have corresponding XML the mergefield label is printed in the output document. Is there anyway of ingoring or deleting this mergefield if it is not used?

Thanks,
Rich.


#2

Use MailMerge.DeleteFields to delete all merge fields left after mail merge.

If you need to delete only some fields based on conditional logic, probably it’s better to define MergeFieldEvent handler and return empty string “” as a field value for the fields you want deleted.


#3

Thanks Roman,

The DeleteFields command worked great.

Rich.