Exporting data into PDF/XLS/XML/CSV formats using the DataExporter component
The DataExporter component provides the ability to export the DataTable data into various formats such as Excel, PDF, CSV, and XML. DataExporter provides options for:
- Exporting entire DataTable rows
- Exporting only current page rows
- Exporting only selected rows
- Excluding particular columns
- Customizing exporting data using pre- and post-processors
To export data into PDF and Excel formats, we need itext.jar
and apache-poi.jar
respectively to be added to the classpath:
<dependency> <groupId>org.apache.poi</groupId> <artifactId>poi</artifactId> <version>3.7</version> </dependency> <dependency> <groupId>com.lowagie</groupId> <artifactId>itext</artifactId> <version>2.1.7</version> </dependency>
The basic usage of DataExporter is as follows:
<p:dataTable id="usersTbl" var="user" value="#{adminController...