We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get elements between two Merge fields?

Yes merge field can be used to replace a field with a value.
But if when I want to delete everything between two merge fields, how can I implement it?
First I think about creating a range between those merge fields, but I could not find any way to do it.
Can you give me a suggestion?

Thanks for your inquiry. I think that you can try using sections in your template. For example see attached document and the following code.

// Open that template document
Document doc = new Document("in.doc");
// Remove section
string[] names = { "FirstName", "LastName", "Company" };
string[] values = { "Alexey", "Noskov", "Aspose" };
// Execute mail merge
doc.MailMerge.Execute(names, values);
// Save output document

I hope this could help you.
Best regards.