How to define an Excel templdate

First, Tiefaces only support xlsx format now, so be sure the format is correct.

Tiefaces use several special commands in the cell comment to define form features.

Define Form Layout

By default Tiefaces render the template as excel liked web sheet as below (e.g. with excel columns and rows):

web sheet default rendering

In case you want normal form header instead of letters, you can use form command to define it in the cell's comment:

(Note: 1. The cell's position become the form's start position. 2. Each command in the comment must remain in the same line, don't use enter key to divide it.)

...
	tie:form(name="sale report" length="9" headerLength="4" footerLength="1")
	...
	

In this example, the top 4 rows become the header of the web form, while the last row become footer

web sheet render with form defined

See the form command page for detail.

Define Editable Cells.

Editable cells are unlocked cells in the template. By default, excel create cells as locked. You can unlock it via "Format Cells" menu.

web sheet render with form defined

For example, if you want to input/output employee name in a cell, you can put ${employee.name} in the cell (assuming the employee object is avaliable in the context). As you can see, the definition is JEXL expression warpped with ${ and }.

Define Data.

Tiefaces supports Apache JEXL as an expression language in the excel template.

For example, if you want to input/output employee name in a cell, you can put ${employee.name} in the cell (assuming the employee object is avaliable in the context). As you can see, the definition is JEXL expression warpped with ${ and }.

define data in cell

Define Data Collections.

To support nested data collections, use each command to define the structure:

define each command

In this example, we defined 2 each command: "deparment" and "employee". "deparment" contain 8 rows while "employee" contain 1 row. Each command allow add/delete rows.

...
tie:each(items="departments", var="department", length="8" allowAdd="true")

tie:each(items="department.staff", var="employee", length="1" allowAdd="True")
...

See the each command page for detail.

Define Edit Widget.

Tiefaces support multiple Primeface input widget for cell input method (i.e. calandar, dropdown, inputNumber, inputArea..).
Use widget command to define the widget name and attributes:

...
$widget.calendar{showOn="button" pattern="yyyy/MM/dd" readonlyInput="true"}
$widget.dropdown{itemLabels="Male;Female" itemValues="M;F" }
$widget.inputnumber{symbol=" years" symbolPosition="s" minValue="0" maxValue="999" decimalPlaces="2"}
...

See the widget command page for detail.