We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Mail Merge with Images


I followed the example code for inserting images into a Word document when performing a mail merge. For some reason its not seeing the merge field as an image type its being called from with the getValue method rather than the imageFieldMerging method.

Just wondered if I have missed anything when setting up the Word template - I have attached a test one I am working with.



PS your forum search doesnt appear to be working.

Hi Mark,

Thanks for your request. Your template is setup properly. You can use the following simple code for testing:

Document doc = new Document("C:\\Temp\\demodoc1.doc");

doc.getMailMerge().execute(new String[] { "barcode" }, new Object[] { "C:\\Temp\\logo.png" });


getValue method is the method from IMailMergeDatasource interface, if you are using IMailMergeDatasource, getValue method will be called for each mergefield.

imageFieldMerging method is from IFieldMergingCallback, if you use callback, this method will be called when a field name contains “Image:” at the beginning.

Yes, we are aware that search in forum does not work. Hopefully this will be fixed shortly. I apologize for inconvenience.

Best regards.