Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
   [Expand]Getting Started
   [Expand]RichEditControl Document
   [Collapse]Fields
    [Collapse]Field Codes
      AUTHOR
      COMMENTS
      CREATEDATE
      DATE
      DOCPROPERTY
      DOCVARIABLE
      HYPERLINK
      IF
      INCLUDEPICTURE
      KEYWORDS
      LASTSAVEDBY
      MERGEFIELD
      NUMPAGES
      PAGE
      PRINTDATE
      REVNUM
      SAVEDATE
      SEQ
      SUBJECT
      SYMBOL
      TC
      TIME
      TITLE
      TOC
    [Expand]Format Switches
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Printing
    Spell Checking
    AutoCorrect
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
    Traversing the Document
   [Expand]Visual Elements
    Services
    Events
    Commands
   [Expand]Member Tables
    Keyboard Shortcuts
    HTML Tag Interpretation
   [Expand]Examples
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

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.

The MERGEFIELD field is displayed as a placeholder when the ShowAllFieldResultsCommand command is executed, as shown on the image below:

Set the RichEditMailMergeOptions.ViewMergedData to true or execute the ToggleViewMergedDataCommand command to view the MERGEFIELD code result:

Expanded See Also

How would you rate this topic?​​​​​​​