com.aspose.words
Class OdsoFieldMapDataCollection
java.lang.Object
com.aspose.words.OdsoFieldMapDataCollection
- All Implemented Interfaces:
- java.lang.Iterable
public class OdsoFieldMapDataCollection
- extends java.lang.Object
A typed collection of the OdsoFieldMapData objects.
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, Odso.FieldMapDatas
Method Summary |
int | add(OdsoFieldMapData value) | |
Adds an object to the end of this collection.
|
void | clear() | |
Removes all elements from this collection.
|
java.util.Iterator<OdsoFieldMapData> | iterator() | |
Returns an iterator object that can be used to iterate over all items in the collection.
|
void | removeAt(int index) | |
Removes the element at the specified index.
|
OdsoFieldMapDataCollection
public OdsoFieldMapDataCollection()
-
Property Getters/Setters Detail |
getCount | |
public int getCount()
|
-
Gets the number of elements contained in the collection.
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();
-
Gets or sets an item in this collection.
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();
-
Adds an object to the end of this collection.
- Parameters:
value
- The object to add. Cannot be null.
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();
clear | |
public void clear() |
-
Removes all elements from this collection.
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();
-
Returns an iterator object that can be used to iterate over all items in the collection.
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();
removeAt | |
public void removeAt(int index) |
-
Removes the element at the specified index.
- Parameters:
index
- The zero-based index of the element.
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:
Aspose.Words Documentation - the home page for the Aspose.Words Product Documentation.
Aspose.Words Support Forum - our preferred method of support.