I’ve created a more simplified sample that contains only one expression, which uses a merge field, and a link. SampleMergeField.zip (37.9 KB)
Input.doc was generated from our internal application while Output.docx was processed/created manually to show the desired behaviour.
Basically, what are we trying to achieve is replacing the expressions including the merge fields with the values only but the links should not be affected.
Unfortunately, I’m not in a position I can write console application as I’m not a .net developer and I’m just modifying an existing code, so hopefully the new sample would be helpful.
However, as shown in my first post we are passing on the values to the templates via doc.MailMerge.Execute(fields.ToArray(), data.ToArray()); to generate documents like Input.doc – the template that Input.doc was created from is also attached.
I’d like to remind you that to view the expressions (and merge fields) in Input.doc click ALT+F9 and if you do the same in Output.docx you won’t be able to see the expressions as the file contains values only.
Thanks in advance