Free Support Forum - aspose.com

MailMerge.GetFieldNames() Returns Image MergeFields prefixed with 'Image:'

Hello there,

I am inserting Image Merge Fields at run time as:

string imageName = “TestImage”;
builder.InsertField(string.Format(“MERGEFIELD Image:{0}”, imageName), string.Format("«Image:{0}»", imageName));

and when I call objDocumentMailMerge.GetFieldNames(), it returns Image field names prefixed with ‘Image:’, so for above code, it will give ‘Image:TestImage’.

Is that correct, or I am doing something wrong here…
(I was expecting it to return just ‘TestImage’, though if above code is right, I can always chop off ‘Image:’ to get correct field names.)

Thank you!

Hi Nutan,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Yes, this is expected behavior. MailMerge.GetFieldNames just returns names of all merge fields in the document.

Best regards.