In version X13, a new property has been introduced that specifies whether the content of empty merge blocks should be removed from the template or not: RemoveEmptyBlocks. This can be very helpful for dynamic templates where under specific circumstances, a complete block should be rendered or not.

Consider the following sample class structure that is used as the merge data object:

Loading...

The name of the dynamic block in the template is Appendix and the master object is Data. If the property Appendix of the class Data has been set to a valid object of type Appendix, the block data exists and is merged.

Loading...

If the property RemoveEmptyBlocks of MailMerge is set to true (code line 14) and the merge data is missing (code line 8), the complete block gets removed.

This new concept allows you to create dynamic structures and conditional blocks in a template. Merge blocks are not necessarily blocks that repeat content. Using merge blocks, you can also define a named range of formatted text with data from another object.