How to export ADF Pivot Table into an Excel file.
This section we explained how to export an ADF Pivot table into an excel sheet.The component dvt:exportPivotTableData helps to export the table into an Excel file, and it requires an ID attribute which is the id of PivotTable and type attribute which is excelHTML. Also, the exportPivotTableData requires an action component button or link to bind.
I have used a custom Sales tables in this example. To download the DDL sales.sql
ADF Pivot Table Excel export
1. Here we are creating Pivot table by dropping Sales VO into the JSF page. Move attributes from Available Attributes to Row and Column edges
2. Now the Pivot Table render into the JSF page, and it has an id attribute.
3. Create a Button component by dropping a button component into the JSF page
4. Now drop exportPivotTableData inside the button component. Enter the id of the PivotTable in ExportedId, and excelHTML in Type
5. Now add filename, exportedData and title attributes in the <dvt:exportPivotTableData> component as shown below
Note: if you set exportedData=” selected” then only the selected Pivot table will be exported into an excel file.
<af:button id="b1" text="Export Excel" >
<dvt:exportPivotTableData exportedId="pt1" type="excelHTML" exportedData="all" filename="all_xls.xls" title="All Data"/>
6. Click on the button to download excel sheet
The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.
Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply 🙂
Latest posts by Govind
- JSF Login Logout Form Authentication Example - October 16, 2017
- How to Bookmark URL in JSF using GET method and ViewParam – example - October 14, 2017
- JSF Dynamic Navigation and how to use wildcard in navigation - October 12, 2017