Hi James,
Thanks
for your inquiry. Unfortunately, at the moment Aspose.Words does not provide any API to sort data by mail merge field. However, you can pass sorted data source to mail merge engine to get the required output. E.g using DataView.Sort property, you can sort the DataTable and use it in mail merge.
MailMerge.ExecuteWithRegions Method (DataView) performs mail merge from a DataView into the document with mail merge regions.
MailMerge.Execute Method (DataView) performs mail merge from a DataView into the document.
These methods are useful if you retrieve data into a DataTable but then need to apply a filter or sort before the mail merge.
Hope this answers your query. Please let us know if you have any more queries.