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

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 = 15;

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(newDataSource);
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
        }
    }
}));

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

richEdit.mailMergeOptions.setDataSource(null);