Free Support Forum -

Replacing missing mail merge fields with static text

Can anyone suggest a simple and elegant way to replace all missing mail merge fields with static text?

I do not require any logic to the text or the mail merge field. Quite simply, the scenario is:

if mailmergefield.ismissing then

replace mailmergefield.text with "SORRY DATA IS MISSING"

Hi David,

Thanks for your inquiry. One simple way to achieve this as follows:

Document doc = new

DocumentBuilder builder = new DocumentBuilder(doc);

doc.MailMerge.Execute(new string[] { "a", "d" }, new object[] { 1, 4 });

string[] remainingMergeFields = doc.MailMerge.GetFieldNames();

foreach (string fieldName in remainingMergeFields)



builder.Write("SORRY DATA IS MISSING");



I hope, this helps.

Best Regards,