Skip to main content
A newer version of this page is available. .

MailMergeOptions Class

Contains properties related to the mail merge functionality.

Declaration

export class MailMergeOptions

Remarks

An object of the MailMergeOptions class can be accessed via the mailMergeOptions property.

Properties

activeRecordIndex Property

Specifies the active record’s index.

Declaration

activeRecordIndex: number

Property Value

Type Description
number

The active record index.

Remarks

Use the activeRecordIndex method to navigate through records when the viewMergedData property is set to true.

++richEdit.mailMergeOptions.activeRecordIndex;

viewMergedData Property

Specifies whether the merged data is displayed in the Rich Text Editor.

Declaration

viewMergedData: boolean

Property Value

Type Description
boolean

true to display the merged data; false to hide the merged data.

Remarks

richEdit.mailMergeOptions.viewMergedData = true;

Methods

getDataSource Method

Returns a data source object to which the mail merge functionality is bound.

Declaration

getDataSource(): any

Returns

Type Description
any

A data source object.

Remarks

richEdit.mailMergeOptions.getDataSource();

setDataSource(dataSource) Method

Specifies the data source for the mail merge.

Declaration

setDataSource(
    dataSource: any,
    callback?: (success: boolean) => void
): void

Parameters

Name Type Description
dataSource any

The data source object.

callback (success: boolean) => void

A function that is called after the data source is initialized.

Remarks

The setDataSource method can accept the DataSource object as the dataSource parameter.

var newDataSource = [
    { firstName: "Alex", birthYear: 1991 },
    { firstName: "Joe", birthYear: 1990 },
    { firstName: "Bob", birthYear: 1995 }
];
richEdit.mailMergeOptions.setDataSource(new DevExpress.data.DataSource({
    store: {
        type:'array', data: newDataSource
    },
    filter: ['birthYear', '>', 1990],
    map: function (dataItem) {
        return {
            description: dataItem.firstName + ' was born in ' + dataItem.birthYear,
            firstName: dataItem.firstName
        }
    }
}))

// or
DemoRichEdit.mailMergeOptions.setDataSource(newDataSource)

Send null or undefined as a parameter to remove the data source from the control and disable the mail merge functionality.

richEdit.mailMergeOptions.setDataSource(null);