Mail merge with dynamic QR Code on Word document

I am a .NET developer supporting an ASP.NET application that creates MS Word documents thru the mail merge process in Aspose.Words. On these documents we are trying to put a dynamic QR Code. Meaning, the QR Code contains data that is passed in thru the mail merge process.

I have found that the TBarCode Word Add-in (sold by www.tec-it.com) works pretty well to create these dynamic QR Codes. However, when I try running my application that calls the Aspose.Words software to do the mail merge, the QR Code is exactly the same on each document. Each QR Code should actually contain the current variable merge data.

If I bring up the template and perform the mail merge manually, the QR Codes get generated perfectly.

Is there a short coming to the mail merge function within Aspose.Words?

If you have a recommendation for a QR Code creator that works well with your Aspose.Words software that can accept data from a mail merge field during the QR Code build process, I would love to hear your recommendation.

Hi Dan,

Thanks for your inquiry. In case you’re using an older version of Aspose.Words, I would suggest you please upgrade to the latest version (v11.11.0) from here and let us know how it goes on your side. If the problem still remains, please attach your input Word document along with QR Codes here for testing. I will investigate the issue on my side and provide you more information.

I was using the latest version. Attached is my Word doc that has my TBarCode object within that won’t update during the mail merge process. You might want to download your own copy of the TBarCode software for your research: http://www.tec-it.com/en/download/tbarcode-office/Download.aspxv

When I contacted Tec-IT about this issue, they said this:

I don’t know ASPOSE.Words but can you please check if it is working with Events to start printing the mail merge? This may cause the problem. Our TBarCode Office is working with events too so it might be that TBarCode Office is switching off some events which are needed by ASPOSE.Words.

Thanks for your help!

Hi Dan,

Thanks for sharing the details. Please note that Aspose.Words can generate documents from templates with mail merge fields. The data from an external source like a database or file is placed into these fields and formatted, and the resulting document is saved in the folder you specify.

The TBarCode control is inserted as { CONTROL TBarCode10.TBarCode10.1 } and unfortunately, there is no way to insert ActiveX controls into MS Word documents using Aspose.Words.

Moreover, TBarCode responds to the events fired by Microsoft Word Application and this behavior is different from Aspose.Words events. Aspose.Words generates information during mail merge and it has it’s own event. The TBarCode doesn’t respond to the events fired by Aspose.Words. To be able to achieve this you needs to implement your own QR Code Generator using .NET which takes input string/byte array as parameter and returns an image.

Hope this answers your query. Please let us know if you have any more queries.