Use Embedded Fields (Mail Merge)

  • 2 minutes to read

This topic describes how to use Mail Merge to bind report controls to data. This feature allows you to create templates where data source values populate specific placeholders while other text remains constant.

You can apply mail merge to the following controls' Text:

Embed Fields in a Control Text

You can apply mail merge to the Text property only. Double-click a control on the design surface to invoke the in-place editor. Insert data field names with square brackets to create embedded fields and use any prefixes or postfixes.

mail-merge-insert-data-fields

You can also refer to collection elements or nested properties.

mail-merge-insert-data-fields-full-filename-path

Use the [?ParameterName] syntax to embed a parameter's value into a control's content.

mail-merge-insert-parameters

A database barrel icon is displayed above the control if embedded fields are valid for the report's data source and data member. The same icon appears if you specify a binding expression for the control.

In the Rich Text control, you can select any text part and use the formatting toolbar to adjust its color and font.

mail-merge-formatting-text

Embedded fields are replaced with values obtained from the report's data source when users preview or export the report:

mail-merge-print-preview-result

Format Embedded Fields

Mail merge enables you to apply formats to embedded field values. Select a data field and expand the control's smart tag. Click the Format String property's ellipsis button and choose a built-in format pattern in the invoked Format String Editor.

mail-merge-format-string

This adds the selected format to the data field. The format specifier is separated from the field name with the ! character and applies this format to field values when users preview or export a document.

mail-merge-formatting-result

Limitations

  • Embedded fields cannot be exported to XLS and XLSX as values; they are always exported as plain text. We recommend that you use text formats instead to combine dynamic data and static text.