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

Free Support Forum - aspose.com

How to find the Next field in the template document using .NET

I’d like to detect if a document is a mailing labels template or a standard template, in order to perform .Execute(DataTable) or .Execute(DataRow)+ExecuteWithRegions. I’d like to search for the “Next” field, but I cannot find it in FormFields or MailMerge.GetFieldNames collections.

Is there any way to do it?

Thank you


Sure. Here it is:

NodeCollection fields = doc.GetChildNodes(NodeType.FieldStart, true);

foreach (FieldStart field in fields)


if (field.FieldType == FieldType.FieldNext)


// ... This is a mailing labels template




We would like to share with you that you can use LINQ Reporting to achieve your requirement using NEXT field. We added support of this field in Aspose.Words 16.8.

Using this field, you can instruct the engine to force movement to the next item within a data band using a next tag.

Please check the following template syntax. The Clients is a DataTable instance having a field named “Name”.

<<foreach [c in Clients]>>