com.aspose.words

Class MailMergeRegionInfo

  • java.lang.Object
    • com.aspose.words.MailMergeRegionInfo
public class MailMergeRegionInfo 
extends java.lang.Object

Contains information about a mail merge region.

Property Getters/Setters Summary
FieldMergeFieldgetEndField()
Returns an end field for the region.
java.util.ArrayList<Field>getFields()
Returns a list of child fields.
intgetLevel()
Returns the nesting level for the region.
java.lang.StringgetName()
Returns the name of region.
java.util.ArrayList<MailMergeRegionInfo>getRegions()
Returns a list of child regions.
FieldMergeFieldgetStartField()
Returns a start field for the region.
 

    • Property Getters/Setters Detail

      • getEndField

        public FieldMergeField getEndField()
        
        Returns an end field for the region.

        Example:

        Shows how to get MailMergeRegionInfo and work with it
        Document doc = new Document(getMyDir() + "MailMerge.TestRegionsHierarchy.doc");
        
        //Returns a full hierarchy of regions (with fields) available in the document.
        MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
        
        //Get top regions in the document
        ArrayList topRegions = regionInfo.getRegions();
        Assert.assertEquals(topRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getName(), "Region1");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getName(), "Region2");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getLevel(), 1);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getLevel(), 1);
        
        //Get nested region in first top region
        ArrayList nestedRegions = ((MailMergeRegionInfo)topRegions.get(0)).getRegions();
        Assert.assertEquals(nestedRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getName(), "NestedRegion1");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getName(), "NestedRegion2");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getLevel(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getLevel(), 2);
        
        //Get field list in first top region
        ArrayList fieldList = ((MailMergeRegionInfo)topRegions.get(0)).getFields();
        Assert.assertEquals(fieldList.size(), 4);
        
        FieldMergeField startFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getStartField();
        Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
        
        FieldMergeField endFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getEndField();
        Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");
      • getFields

        public java.util.ArrayList<Field> getFields()
        
        Returns a list of child fields.

        Example:

        Shows how to get MailMergeRegionInfo and work with it
        Document doc = new Document(getMyDir() + "MailMerge.TestRegionsHierarchy.doc");
        
        //Returns a full hierarchy of regions (with fields) available in the document.
        MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
        
        //Get top regions in the document
        ArrayList topRegions = regionInfo.getRegions();
        Assert.assertEquals(topRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getName(), "Region1");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getName(), "Region2");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getLevel(), 1);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getLevel(), 1);
        
        //Get nested region in first top region
        ArrayList nestedRegions = ((MailMergeRegionInfo)topRegions.get(0)).getRegions();
        Assert.assertEquals(nestedRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getName(), "NestedRegion1");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getName(), "NestedRegion2");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getLevel(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getLevel(), 2);
        
        //Get field list in first top region
        ArrayList fieldList = ((MailMergeRegionInfo)topRegions.get(0)).getFields();
        Assert.assertEquals(fieldList.size(), 4);
        
        FieldMergeField startFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getStartField();
        Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
        
        FieldMergeField endFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getEndField();
        Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");
      • getLevel

        public int getLevel()
        
        Returns the nesting level for the region.

        Example:

        Shows how to get MailMergeRegionInfo and work with it
        Document doc = new Document(getMyDir() + "MailMerge.TestRegionsHierarchy.doc");
        
        //Returns a full hierarchy of regions (with fields) available in the document.
        MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
        
        //Get top regions in the document
        ArrayList topRegions = regionInfo.getRegions();
        Assert.assertEquals(topRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getName(), "Region1");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getName(), "Region2");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getLevel(), 1);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getLevel(), 1);
        
        //Get nested region in first top region
        ArrayList nestedRegions = ((MailMergeRegionInfo)topRegions.get(0)).getRegions();
        Assert.assertEquals(nestedRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getName(), "NestedRegion1");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getName(), "NestedRegion2");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getLevel(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getLevel(), 2);
        
        //Get field list in first top region
        ArrayList fieldList = ((MailMergeRegionInfo)topRegions.get(0)).getFields();
        Assert.assertEquals(fieldList.size(), 4);
        
        FieldMergeField startFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getStartField();
        Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
        
        FieldMergeField endFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getEndField();
        Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");
      • getName

        public java.lang.String getName()
        
        Returns the name of region.

        Example:

        Shows how to get MailMergeRegionInfo and work with it
        Document doc = new Document(getMyDir() + "MailMerge.TestRegionsHierarchy.doc");
        
        //Returns a full hierarchy of regions (with fields) available in the document.
        MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
        
        //Get top regions in the document
        ArrayList topRegions = regionInfo.getRegions();
        Assert.assertEquals(topRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getName(), "Region1");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getName(), "Region2");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getLevel(), 1);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getLevel(), 1);
        
        //Get nested region in first top region
        ArrayList nestedRegions = ((MailMergeRegionInfo)topRegions.get(0)).getRegions();
        Assert.assertEquals(nestedRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getName(), "NestedRegion1");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getName(), "NestedRegion2");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getLevel(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getLevel(), 2);
        
        //Get field list in first top region
        ArrayList fieldList = ((MailMergeRegionInfo)topRegions.get(0)).getFields();
        Assert.assertEquals(fieldList.size(), 4);
        
        FieldMergeField startFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getStartField();
        Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
        
        FieldMergeField endFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getEndField();
        Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");
      • getRegions

        public java.util.ArrayList<MailMergeRegionInfo> getRegions()
        
        Returns a list of child regions.

        Example:

        Shows how to get MailMergeRegionInfo and work with it
        Document doc = new Document(getMyDir() + "MailMerge.TestRegionsHierarchy.doc");
        
        //Returns a full hierarchy of regions (with fields) available in the document.
        MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
        
        //Get top regions in the document
        ArrayList topRegions = regionInfo.getRegions();
        Assert.assertEquals(topRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getName(), "Region1");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getName(), "Region2");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getLevel(), 1);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getLevel(), 1);
        
        //Get nested region in first top region
        ArrayList nestedRegions = ((MailMergeRegionInfo)topRegions.get(0)).getRegions();
        Assert.assertEquals(nestedRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getName(), "NestedRegion1");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getName(), "NestedRegion2");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getLevel(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getLevel(), 2);
        
        //Get field list in first top region
        ArrayList fieldList = ((MailMergeRegionInfo)topRegions.get(0)).getFields();
        Assert.assertEquals(fieldList.size(), 4);
        
        FieldMergeField startFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getStartField();
        Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
        
        FieldMergeField endFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getEndField();
        Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");
      • getStartField

        public FieldMergeField getStartField()
        
        Returns a start field for the region.

        Example:

        Shows how to get MailMergeRegionInfo and work with it
        Document doc = new Document(getMyDir() + "MailMerge.TestRegionsHierarchy.doc");
        
        //Returns a full hierarchy of regions (with fields) available in the document.
        MailMergeRegionInfo regionInfo = doc.getMailMerge().getRegionsHierarchy();
        
        //Get top regions in the document
        ArrayList topRegions = regionInfo.getRegions();
        Assert.assertEquals(topRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getName(), "Region1");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getName(), "Region2");
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(0)).getLevel(), 1);
        Assert.assertEquals(((MailMergeRegionInfo)topRegions.get(1)).getLevel(), 1);
        
        //Get nested region in first top region
        ArrayList nestedRegions = ((MailMergeRegionInfo)topRegions.get(0)).getRegions();
        Assert.assertEquals(nestedRegions.size(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getName(), "NestedRegion1");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getName(), "NestedRegion2");
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(0)).getLevel(), 2);
        Assert.assertEquals(((MailMergeRegionInfo)nestedRegions.get(1)).getLevel(), 2);
        
        //Get field list in first top region
        ArrayList fieldList = ((MailMergeRegionInfo)topRegions.get(0)).getFields();
        Assert.assertEquals(fieldList.size(), 4);
        
        FieldMergeField startFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getStartField();
        Assert.assertEquals(startFieldMergeField.getFieldName(), "TableStart:NestedRegion1");
        
        FieldMergeField endFieldMergeField = ((MailMergeRegionInfo)nestedRegions.get(0)).getEndField();
        Assert.assertEquals(endFieldMergeField.getFieldName(), "TableEnd:NestedRegion1");