com.groupdocs.parser.templates

Class Template

    • Constructor Detail

      • Template

        public Template(Iterable<? extends TemplateItem> items)
        Initializes a new instance of the 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));
         
        Parameters:
        items - The collection of TemplateItem objects.
    • Method Detail

      • getCount

        public int getCount()
        Gets the total number of template items.
        Returns:
        An integer that represents the total number of template items.
      • get

        public TemplateItem get(int index)
        Gets the template item by an index.
        Parameters:
        index - The zero-based index of the template item.
        Returns:
        An instance of TemplateItem class.