19.2. Creating a simple workbook
The worksheet support is used like a
<h:dataTable>
, and can be bound to a List
, Set
, Map
, Array
or DataModel
.
<e:workbook xmlns:e="http://jboss.com/products/seam/excel"> <e:worksheet> <e:cell column="0" row="0" value="Hello world!"/> </e:worksheet> </e:workbook>
The following is a more common use case:
<e:workbook xmlns:e="http://jboss.com/products/seam/excel"> <e:worksheet value="#{data}" var="item"> <e:column> <e:cell value="#{item.value}"/> </e:column> </e:worksheet> </e:workbook>
The top-level
workbook
element serves as the container, and has no attributes. The child element, worksheet
, has two attributes: value="#{data}"
is the EL-binding to the data, and var="item"
is the name of the current item. The worksheet contains a single column
. Within this is the cell
, which is the final bind to the data in the currently iterated item.
Now you can bind your data into spreadsheets.