exporterActionListener allows exporting HtmlDataTable contents as an excel or a pdf file. It is an action listener that can be attached to any action source component like commandButton. Here is an example of usage :

<h:commandButton value="export">

    <s:exporterActionListener filename="myFile" 
	    		      fileType="<XLS or PDF>" 
			      for="<your dataTable ID>">;

</h:commandButton>

Here are the exporterActionListener attributes :

  • fileType: An attribute to specify whether to export an excel or a pdf file, possible values are {'XLS', 'PDF'}.
  • for: An id of the dataTable to be exported.
  • filename: An optional attribute to specify the filename of the exported excel or pdf file.

The underlying excel exporting engine used is (Apache POI) while the pdf one is (iText). Attribute (for) is the id of the datatable whose value to be exported, (fileType) is an attribute to specify whether to export an excel or a pdf file , possible values are {'XLS', 'PDF'} , and (filename) is an optional attribute to specify the filename of the exported excel or pdf file.

  • No labels