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

Free Support Forum - aspose.com

Show "Invalid Merge Field" dialog when merge field does not match with the datasource field


We are using Aspose.Word to convert MS Word documents to PDF. Before converting Word document to PDF we do merge functionality on it.

I want to know that: Is there any way to show "Invalid Merge Field" dialog like in Word when merge field does not match with the datasource field. And using that dialog we can replace that merge field with another datasource field or remove that field from document and in this way we can correct our document for merging.


Thanks for your request. I think in your case you should use MappedDataField to automatically map between names of fields in your data source and names of mail merge fields in the document.


Also please see the following link to learn how to rename mergefields in the document:


Hope this helps.

Best regards.


Thanks for your quick reply.

I have checked both link as you mentioned in your reply but in that example static mapping is done. So is there any way by which it can automatically identify Invalid Merge Fields and display a list?


Thanks for your inquiry. You can use GetFieldNames method to get list of merge fields in the document. Please follow the link to learn more about this method:


And then you can compare this list with the list of field names of your data source.

Best regards,