Free Support Forum - aspose.com

Remove Field

If I have the index value of a merge field, how can I remove it?

Hi

Thanks for your request. Merge field will be removed if you fill it with empty data. See the following code.

Document doc = new Document(@"259_98243_derekmhart@yahoo.com\in.doc");

int index = 1;

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

doc.MailMerge.RemoveEmptyParagraphs = true;

doc.MailMerge.Execute(new string[] { names[index] }, new string[] { string.Empty });

doc.Save(@"259_98243_derekmhart@yahoo.com\out.doc");

I hope that it will help you.

Best regards.