Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

MailMergeOptions Class

Contains properties related to the mail merge functionality.

#Declaration

TypeScript
export class MailMergeOptions

#Properties

#activeRecordIndex Property

Specifies the active record’s index.

#Declaration

TypeScript
get activeRecordIndex(): number
set activeRecordIndex(value: 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.

#viewMergedData Property

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

#Declaration

TypeScript
get viewMergedData(): boolean
set viewMergedData(value: boolean)

#Property Value

Type Description
boolean

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

#Remarks

#Methods

#getDataSource Method

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

#Declaration

TypeScript
getDataSource(): any

#Returns

Type Description
any

A data source object.

#Remarks

#setDataSource(dataSource) Method

Specifies the data source for the mail merge.

#Declaration

TypeScript
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.