public class ExcelWorksheet extends RowObjectContainer
An object of this class contains the results of parsing a worksheet of an Excel input file. The object is passed as part of the data model to the template engine for rendering the information in the wanted format.
Formally, an ExcelWorksheet object is a Java Map, which contains groups of
Excel rows, looked up by name. Such a group of rows is represented by a RowObjectContainer object. The name of a group is taken from the cells in the grouping
column(s) of the worksheet. If the worksheet defines two groups "myGroupA" and
"myGroupB", then these groups would be accessed from a StringTemplate V4 template with
an expression like <sheet.myGroupA> or <sheet.myGroupB>.
The worksheet provides more information to the rendering process. The map of row
object groups is extended by some so-called "pseudo-fields", which can be accessed from
a template by means of the dot notation. As an example, the worksheet has a name and
this name can be accessed by the template expression <sheet.name_>; where name_ denotes a pseudo-field. (It's impossible to name a group of rows "name_", this is
a reserved keyword.)
The list of all supported pseudo-fields is documented as enumeration ExcelWorksheet.PseudoFieldName.
ExcelWorksheet is derived from its base classes and the base classes'
pseudo-fields are inherited and can be accessed in the same way. They are documented as
enumerations RowObjectContainer.PseudoFieldName and ObjectMap.PseudoFieldName.
| Modifier and Type | Class and Description |
|---|---|
static class |
ExcelWorksheet.PseudoFieldName
This is the list of pseudo-fields of class
ExcelWorksheet that can be
accessed from a StringTemplate V4 template. |
| Modifier and Type | Field and Description |
|---|---|
FileExt |
excelFile
The file designation of the Excel source.
|
boolean |
isRoot
This always true flag indicates that we are a Worksheet.
|
ExcelWorkbook |
parentBook
The workbook by reference, which contains this worksheet.
|
java.lang.String |
tabName
The title string of the tab as found in the Excel file.
|
prop, rowAry| Constructor and Description |
|---|
ExcelWorksheet(excelExporter.excelParser.ErrorCounter errCnt,
java.lang.String logContext,
java.lang.String name)
Create a new Excel worksheet object.
|
| Modifier and Type | Method and Description |
|---|---|
void |
setParent(ExcelWorkbook parent)
Set parent of the worksheet.
|
addRow, addRowWithPath, getNoRows, putGroup, sortcontainsKey, createComparator, entrySet, get, getNoItems, put, putItem, setIndexInCollection, toStringpublic FileExt excelFile
FileExt.public java.lang.String tabName
public ExcelWorkbook parentBook
public final boolean isRoot
true if and only if the queried container is the root container or with other
words the complete Worksheet object. The disticntion between a true Worksheet and
sub-groups of row objects can be useful when writing generic templates. Example:
<if(container.isRoot)>This is a worksheet object<else>This is a sub-group
of the worksheet<endif>
public ExcelWorksheet(excelExporter.excelParser.ErrorCounter errCnt,
java.lang.String logContext,
java.lang.String name)
errCnt - A client supplied error counter. The use case is to permit consecutive error
counting across different phases of parsing.logContext - A string used to precede all logging statements of this module. Pass null if not
needed.name - The name of the object, which is the name to retrieve the object from the data
model. The name should not be empty. If so a generic name is chosen instead.public void setParent(ExcelWorkbook parent)
parent - A reference to the workbook, which contains this worksheet.