execute method

execute(data_source)

Performs a mail merge from a custom data source.

def execute(self, data_source: aspose.words.mailmerging.IMailMergeDataSource):
    ...
ParameterTypeDescription
data_sourceIMailMergeDataSourceAn object that implements the custom mail merge data source interface.

Remarks

Use this method to fill mail merge fields in the document with values from any data source such as a list or hashtable or objects. You need to write your own class that implements the IMailMergeDataSource interface.

You can use this method only when FieldOptions.is_bidi_text_supported_on_update is False, that is you do not need Right-To-Left language (such as Arabic or Hebrew) compatibility.

This method ignores the MailMergeCleanupOptions.REMOVE_UNUSED_REGIONS option.

execute(field_names, values)

Performs a mail merge operation for a single record.

def execute(self, field_names: List[str], values: List[object]):
    ...
ParameterTypeDescription
field_namesList[str]Array of merge field names. Field names are not case sensitive. If a field name that is not found in the document is encountered, it is ignored.
valuesList[object]Array of values to be inserted into the merge fields. Number of elements in this array must be the same as the number of elements in fieldNames.

Remarks

Use this method to fill mail merge fields in the document with values from an array of objects.

This method merges data for one record only. The array of field names and the array of values represent the data of a single record.

This method does not use mail merge regions.

This method ignores the MailMergeCleanupOptions.REMOVE_UNUSED_REGIONS option.

See Also