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

Hi,
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.

Hello
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.
https://docs.aspose.com/words/net/advanced-mail-merge-features/
Also please see the following link to learn how to rename mergefields in the document:
https://docs.aspose.com/words/net/working-with-form-fields/
Hope this helps.
Best regards.

Hi
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?

Hi

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:
https://reference.aspose.com/words/net/aspose.words.mailmerging/mailmerge/getfieldnames/
And then you can compare this list with the list of field names of your data source.

Best regards,