19.13. Datatable exporter

If you prefer to export an existing JSF datatable instead of writing a dedicated XHTML document, you can execute the org.jboss.seam.excel.excelExporter.export component, passing in the ID of the datatable as an Seam EL parameter. For example, say you have the following datatable:
 
<h:form id="theForm"> 
  <h:dataTable id="theDataTable" value="#{personList.personList}" 
     var="person"> 
    ... 
  </h:dataTable> 
</h:form>
If you want to view this as a Microsoft Excel spreadsheet, place the following in the form:
 
<h:commandLink value="Export" 
   action="#{excelExporter.export('theForm:theDataTable')}" />
You can also execute the exporter with a button, s:link, or other preferred method.