com.aspose.words

Class OdsoFieldMappingType

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

Utility class containing constants. Specifies the possible types used to indicate if a given mail merge field has been mapped to a column in the given external data source.

Example:

Shows how to access the collection of data that maps data source columns to merge fields.
Document doc = new Document(getMyDir() + "Odso data.docx");

// This collection defines how columns from an external data source will be mapped to predefined MERGEFIELD,
// ADDRESSBLOCK and GREETINGLINE fields during a mail merge
OdsoFieldMapDataCollection dataCollection = doc.getMailMergeSettings().getOdso().getFieldMapDatas();
Assert.assertEquals(30, dataCollection.getCount());

int index = 0;

for (OdsoFieldMapData data : dataCollection) {
    System.out.println(MessageFormat.format("Field map data index #{0}, type \"{1}\":", index++, data.getType()));

    if (data.getType() != OdsoFieldMappingType.NULL) {
        System.out.println(MessageFormat.format("\tColumn named {0}, number {1} in the data source mapped to merge field named {2}.", data.getName(), data.getColumn(), data.getMappedName()));
    } else {
        System.out.println("\tNo valid column to field mapping data present.");
    }
}

// Elements of the collection can be cloned
Assert.assertNotEquals(dataCollection.get(0), dataCollection.get(0).deepClone());

// The collection can have individual entries removed or be cleared like this
dataCollection.removeAt(0);
dataCollection.clear();
See Also:
OdsoFieldMapData.Type

Field Summary
static final intCOLUMN = 0
Specifies that the mail merge field has been mapped to a column in the given external data source.
static final intNULL = 1
Specifies that the mail merge field has not been mapped to a column in the given external data source.
static final intDEFAULT = 1
Equals to NULL.
 

    • Field Detail

      • COLUMN = 0

        public static final int COLUMN
        Specifies that the mail merge field has been mapped to a column in the given external data source.
      • NULL = 1

        public static final int NULL
        Specifies that the mail merge field has not been mapped to a column in the given external data source.
      • DEFAULT = 1

        public static final int DEFAULT
        Equals to NULL.