The requested page is not available for the requested platform. You are viewing the content for .NET Framework 4.5.2+ platform.

MERGEFIELD

MERGEFIELD

MailMerge field

{ MERGEFIELD "field name" [ switch ] [\* MERGEFORMAT] }

When the main document is merged with the selected data source, information from the specified data field is inserted in place of the merge field. The \* MERGEFORMAT switch retains the formatting applied to the field.

The \b "text" switch specifies the text to be inserted before the MERGEFIELD field if the field is not blank.

The \f "text" switch specifies the text to be inserted after the MERGEFIELD field if the field is not blank.

Example:

{ MERGEFIELD FirstName \f" " }{ MERGEFIELD MiddleName \f" " }{ MERGEFIELD LastName }

If the MiddleName field data is missing (null), then there is only one space between FirstName and LastName:

David Bradley

Otherwise, MiddleName is separated by spaces as required:

David M Bradley

If the merge field is replaced with a DateTime value and no formatting switch is specified, the actual display formatting is dependent on the FieldOptions.UseCurrentCultureDateTimeFormat option. If this option is set to true, the system's Date and Time settings will be used. If the FieldOptions.UseCurrentCultureDateTimeFormat is false (the default value), DateTime values are displayed using the "M/d/yyyy" formatting.