What happen if we use Asynchronous method call for MergeField/MergeImageField event handlers?
Mail merge is a process of merging data from a data source to a Word template document. Syncfusion® Essential® DocIO is a UWP Word library used to generate reports like invoices, payrolls, letters, etc., by performing mail merge faster in a batch process without Microsoft Word or interop dependencies. Using this library, you can perform mail merge on a Word document in UWP.
Internal working process of Mail merge:
DocIO internally clones the contents of the Word document for every record in the mail merge data. Once the mail merge field and record have data matching the merge field name, DocIO triggers MergeField and MergeImageField events to perform necessary customizations while updating values to the merge fields. This process continues for all the records in the mail merge data. This process should be executed sequentially, one by one, to mail merge the Word document with the provided mail merge data.
Behavior of Asynchronous method:
When an asynchronous method is invoked, the control of the main thread will return to the invoke statement immediately and start executing the next statement by queuing the asynchronous method execution to a background thread.
Defining the MergeField and MergeImageField event handler methods as asynchronous will affect the sequential (step-by-step) execution of our existing mail merge functionality and may lead to inconsistent output. Hence, it is not a feasible solution to define asynchronous mail merge event handler methods.
See Also:
Mail merge Word document in UWP
Starting with v16.2.0.x, if you reference Syncfusion® assemblies from the trial setup or from the NuGet feed, include a license key in your projects. Refer to the link to learn about generating and registering the Syncfusion® license key in your application to use the components without a trial message.