public class Template extends Object implements Iterable<TemplateItem>
TemplateItem
objects which represent the items of the template such as text field and table definitions.
Learn more:
Constructor and Description |
---|
Template(Iterable<? extends TemplateItem> items)
Initializes a new instance of the
Template class. |
Modifier and Type | Method and Description |
---|---|
TemplateItem |
get(int index)
Gets the template item by an index.
|
int |
getCount()
Gets the total number of template items.
|
Iterator<TemplateItem> |
iterator() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public Template(Iterable<? extends TemplateItem> items)
Template
class.
Usage:
// Create an array of template fields
TemplateItem[] fields = new TemplateItem[]
{
new TemplateField(new TemplateRegexPosition("From"), "From", 0),
new TemplateField(
new TemplateLinkedPosition("From", new Size(100, 10), new TemplateLinkedPositionEdges(false, false, false, true)),
"FromCompany",
0),
new TemplateField(
new TemplateLinkedPosition("FromCompany", new Size(100, 30), new TemplateLinkedPositionEdges(false, false, false, true)),
"FromAddress",
0)
};
// Create a document template
Template template = new Template(java.util.Arrays.asList(fields));
items
- The collection of TemplateItem
objects.public int getCount()
public TemplateItem get(int index)
index
- The zero-based index of the template item.TemplateItem
class.public Iterator<TemplateItem> iterator()
iterator
in interface Iterable<TemplateItem>