MergeObjects is used to merge a collection of IEnumerable objects. This blog article gives a good overview of how to use MergeObjects with typical business objects. The used template is described in detail in this entry.
This article explains the merge block in detail. Based on the above sample, the merge block repeats all expenses in an expense report:
The below class diagram shows the business object. The merge block data source LineItem and the property LineItems is highlighted:
The complete report is repeated based on the number of passed objects of type Expense in the collection Expenses. The merge block name must match the property name LineItems:
In this sample, the repeating block consists of two similar table rows with same columns and merge fields, but a different background color to realize alternating colors. At the end of row 1, a NEXT field increases the current data row.
Text Control's Reporting engine MailMerge is trying to match merge block names with encapsulated class names in the business object automatically. Merge blocks can be nested in unlimited levels as well. You simply pass a pre-filled business object to MergeObjects and TX Text Control is doing the work for you.