Export table to Excel in Oracle ADF

If you have users that like reports, I have good news to you! Export table to Excel is very simple when you use Oracle ADF. You just have to use the exportCollectionActionListener tag. This way, you allow an action source (<commandButton>, <commandLink>, etc.) to export data from a collection component (<table>, <tree>, <treeTable>) into an external format in declarative way.

Download the sample application – – that export rows (all or selected) from table into Excel report. This application shows the table as printable page too.

Let’s start!
Create a Fusion Web Application (ADF) like image below.


Open the ViewEmployees.jspx file.
Navigate to Data Control pane, drag the EmployeesView1 and drop inside the page as ADF Read-only Table. Mark Multiple Rows, Enable Sorting and Enable Filtering options from Edit Table Columns Dialog, and click on OK to create the table.


Select the table and set the ID property as “tEmployees”.


Now we need to surround table with Panel Collection, a component that contains certain controls / features to work with collection components like <table>, <treeTable> and <tree>. Go to Structure pane, right-click on af:table “tEmployees” and select Surround With. Select Panel Collection and click on OK.



To create menu with export options, go to Structure pane, right-click on menus facet from af:panelCollection, and select Insert inside menus | Menu. Set the Text property as “File”.


Right-click on af:menu “File” and select Insert inside af:menu – File | Menu Item. Repeat the previous steps to add three Menu Items. Set the Text porpeties as “Export to Excel (All Rows)”, “Export to Excel (Selected Rows)” and “Show as Printable Page”.


Go to Component Palette | Operations, drag the Export Collection Action Listener and drop inside the af:commandMenuItem “Export to Excel (All Rows)” from Structure Pane.


In Insert Export Collection Action Listener Dialog, click on Edit from the ExportedId property, navigate through the nodes to find af:table “tEmployees” and click on OK. Set the Type property as excelHTML. Click on Ok.




Set the properties of the af:exportCollectionActionListener.


Repeat the previous steps for the af:commandMenuItem “Export to Excel (Selected Rows)”, and set the properties of the af:exportCollectionActionListener.


Drag the Show Printable Page Behavior and drop inside the af:commandMenuItem “Show as Printable Page” from Structure Pane.


The Structure pane should look like this image.


Now, it is time to test the application!
Right-click on ViewEmployees.jspx page and select Run.

To export all rows, go to menu and select Export to Excel (All Rows) option.



To export selected rows, select some rows, go to menu and select Export to Excel (Selected Rows) option.



To show table as printable page, go to menu and select Show as Printable Page option. This way, you can save the table as image or PDF file.



14 replies on “Export table to Excel in Oracle ADF”

Hello Waslley Souza ,

Its a good example. I have a question here . How do I save the actual column names from the database to excel sheet?


In the View Object file, go to Attributes navigation tab and double-click an attribute.
Go to Control Hints menu, and set the Label Text with the column name from database.
Hope it helps you!

couple of questions

1. how to limit the number rows to download to excel. Because of more data excel download taking time
2. Some data in excel columns shows as 3.33133E+31 instead of full value

I have one column as SSN in the adf page which is masked. When I export the data to excel the ssn is not masked..Is there any way I can get the ssn into the exported excel as masked

tanks for this helpful guide
but i have a problem that not all the rows extracted to the excel sheet

There is a problem in the exported xls file. Its not displaying the leading zeros. Instead of 07/05/2019 its showing 7/05/2019. How can i fix this problem?

Hi ,
When I am exporting to excel , my page becomes unresponsive , that is no button works on page after data gets exported. Can you help.


Comments are closed.