Skip to end of metadata
Go to start of metadata
Contents Summary


This example explains how to populate MailMerge Template with Data Online. You send both Template file and Mail Merge Data file in request body and the API returns populated document in API response. This API represents a controller for executing mail merge. Description of some important parameters of the API is given below:

  • Flag 'withRegions' can be omitted, in this case simple mail merge will be executed. If flag is present and value is 'true' - mail merge with regions will be executed
  • If cleanup parameter is omitted, cleanup options will be None

The cleanup options parameter can contain list of values from below, separated by ",":

  • None - without any cleanup
  • EmptyParagraphs - Specifies whether paragraphs that contained mail merge fields with no data should be removed from the document
  • UnusedRegions - Specifies whether unused mail merge regions should be removed from the document
  • UnusedFields - Specifies whether unused merge fields should be removed from the document
  • ContainingFields - Specifies whether fields that contain merge fields (for example, IFs) should be removed from the document if the nested merge fields are removed
  • RemoveTitleRow - Removes title row of the table if this table doesn't contain any rows except title row. Does not remove title rows in nested tables.
  • RemoveTitleRowInInnerTables - Enable "RemoveTitleRow " for nested tables
  • RemoveStaticFields - Specifies whether static fields should be removed from the document. Static fields are fields, which results remain the same upon any document change. Fields, which do not store their results in a document and are calculated on the fly (like Aspose.Words.Fields.FieldType.FieldListNum, Aspose.Words.Fields.FieldType.FieldSymbol, etc.) are not considered to be static.

Resource URI

Aspose.Words for Cloud APIs' Swagger UI lets you call this REST API directly from the browser. The description of the API and its parameters is also given there.

cURL Example

Input Document: SampleMailMergeTemplate.docx

Mail Merge Data: SampleMailMergeTemplateData.txt

Output Document: TestPostDocumentExecuteMailMerge.docx



Using an SDK (API client) is the quickest way for a developer to speed up the development. An SDK takes care of a lot of low-level details of making requests and handling responses and lets you focus on writing code specific to your particular project. Checkout our GitHub repository for a complete list of Aspose.Words SDKs along with working examples, to get you started in no time. Please check Available SDKs article to learn how to add an SDK to your project.

SDK Examples

  • No labels