The JETT Tag Library

A tag is a XML-like tag that may be inserted into template spreadsheet cells to control how content is displayed during the transformation process. All tags are represented by Java classes that extend the built-in interface Tag. In practice, all tags are subclasses of the abstract class BaseTag, which implements the Tag interface and supplies common tag functionality.

JETT contains a built-in tag library. A tag library is a mapping between tag names and tag class objects. JETT recognizes a tag library by its namespace. The built-in tag library for JETT is JtTagLibrary, known by its namespace "jt". Tag libraries allow XML-like tags to be placed in template spreadsheets, offering a great deal of control over how content is produced in the resultant spreadsheet. Tags may also be nested. That is, some tags may be part of the body of some other tags.

Here are all the tags in the JETT Tag Library:

Like XML, attribute values are always enclosed in double-quote characters, e.g. attr="value". JETT supports escaping literal double-quote characters with a backslash, and escaping backslash characters as well:

  • \" => "
  • \\ => \

All tags in the JETT Tag Library, and any custom tags that subclass BaseTag, support the following common attribute:

Attributes

  • onProcessed: TagListener Optional. Specify a TagListener that will be called when the tag's processing has finished. Alternatively, a fully-qualified Java class name may be specified here, and JETT will instantiate one, provided it has a no-argument public constructor.

Additionally, custom tag libraries may be registered with the ExcelTransformer prior to transformation, to allow the processing of custom tags.

Tag Bodies

Every tag implicitly defines a block of cells on which it operates. A block of cells is simply a rectangular block of cells, with one or more rows, and one or more cells in each row. Below, each block of cells defined by the tags is highlighted in yellow (for descriptive purposes here, not in the actual spreadsheet!) below for each case. The two cases are described below.

Tags With Bodies

When the XML tag consists of a start tag and an end tag, and they lie in different cells, then the tag has a body. The ending tag must be located to the right of the start tag, below the start tag, or both to the right of and below the start tag, or a TagParseException will result at runtime.

             
  <tag attr1="blah">Here's     some    
          user  
  content   inside      
    the     block.</tag>  
             

Bodiless Tags

When the tag is wholly defined without a body, in one cell, then the tag is bodiless. Some tags can be placed in this way, and some cannot.

     
  <tag attr1="blah"/>