New to Telerik Document ProcessingStart a free 30-day trial

Merge Field

Updated on Feb 19, 2026

MergeField is a Field element containing a reference to a data field by its name. When a template document is mail merged with the values from a data source, the data field information replaces the merge field. More information on the mail merge feature is available in the respective article: Mail Merge.

Field Syntax

This is how the syntax of a Merge field looks like:

Syntax
{ MERGEFIELD FieldName [Switches]}

The syntax of a merge field is demonstrated in Figure 1.

Figure 1: Merge Field Code SyntaxRad Words Processing Concepts Merge Field 01

"FieldName"

The name of a data field listed in the header record of the selected data source. The field name must exactly match the field name in the header record.

Switches

Switches are a way for the code fragment to specify formatting for the result of the field. More information is available in the Syntax and Switches section of the Fields article.

The possible switches for a Merge field are:

SwitchDescription
@ "Date-Time Picture"Specifies a date format if different than the default format.
\* Format SwitchSpecifies the appearance of the number if different than the default format.
\bSpecifies text, which shall be inserted before the Merge Field in case the field is not blank
\fSpecifies text, which shall be inserted after the Merge Field in case the field is not blank
\mSpecifies that the MergeField field is a mapped field
\vEnables character conversion for vertical formatting

Inserting

Inserting a Merge field is easily achieved through the RadFlowDocumentEditor's InsertField() method. It accepts code as first argument and result as second argument.

Example 1: Insert Merge field

c#
editor.InsertField("MERGEFIELD First_Name", "«to be updated»");

Example 2: Insert Merge field with switches

c#
editor.InsertField("MERGEFIELD First_Name \\b \"Mr. \" \\f \". \"", "«to be updated»");

Example 3: Insert Merge field with a Date-Time format switch

c#
editor.InsertField("MERGEFIELD Date_Time \\@ \"MM/dd/yy\"", "«to be updated»");

After updating the field the result would be "05/13/21".

See Also