MailMergeRegionInfo Class
Contains information about a mail merge region.
Inheritance Hierarchy
SystemObject
  Aspose.Words.MailMergingMailMergeRegionInfo

Namespace: Aspose.Words.MailMerging
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.9
Syntax
public class MailMergeRegionInfo

The MailMergeRegionInfo type exposes the following members.

Properties
  NameDescription
Public propertyCode exampleEndField
Returns an end field for the region.
Public propertyCode exampleFields
Returns a list of child fields.
Public propertyCode exampleLevel
Returns the nesting level for the region.
Public propertyCode exampleName
Returns the name of region.
Public propertyCode exampleRegions
Returns a list of child regions.
Public propertyCode exampleStartField
Returns a start field for the region.
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Examples
Shows how to get MailMergeRegionInfo and work with it
[C#]

Document doc = new Document(MyDir + "MailMerge.TestRegionsHierarchy.doc");

//Returns a full hierarchy of regions (with fields) available in the document.
MailMergeRegionInfo regionInfo = doc.MailMerge.GetRegionsHierarchy();

//Get top regions in the document
IList<MailMergeRegionInfo> topRegions = regionInfo.Regions;
Assert.AreEqual(2, topRegions.Count);
Assert.AreEqual("Region1", topRegions[0].Name);
Assert.AreEqual("Region2", topRegions[1].Name);
Assert.AreEqual(1, topRegions[0].Level);
Assert.AreEqual(1, topRegions[1].Level);

//Get nested region in first top region
IList<MailMergeRegionInfo> nestedRegions = topRegions[0].Regions;
Assert.AreEqual(2, nestedRegions.Count);
Assert.AreEqual("NestedRegion1", nestedRegions[0].Name);
Assert.AreEqual("NestedRegion2", nestedRegions[1].Name);
Assert.AreEqual(2, nestedRegions[0].Level);
Assert.AreEqual(2, nestedRegions[1].Level);

//Get field list in first top region
IList<Field> fieldList = topRegions[0].Fields;
Assert.AreEqual(4, fieldList.Count);

FieldMergeField startFieldMergeField = nestedRegions[0].StartField;
Assert.AreEqual("TableStart:NestedRegion1", startFieldMergeField.FieldName);

FieldMergeField endFieldMergeField = nestedRegions[0].EndField;
Assert.AreEqual("TableEnd:NestedRegion1", endFieldMergeField.FieldName);
See Also