Wednesday, 27 April 2011

Export Collection in ADF

In many report based or any other data related application export to excel feature is always required.

Export to excel feature can be achieved in ADF very easily, may be just in 10 minutes we can see the result excel sheet. To achieve this in this project I have first created ADF business components from HR.Employee table. Then I created one jspx page to display the employee details table. Now I want to export this  tabular data in one excel named Employee.xls.  want that the employee details data will be displayed under title "List Of Employees " title. 

Now as export to excel will be available on some action so I added one command button here named "Export Collection"


I have inserted one exportCollectionActionListener inside the command button. This takes 5 parameters, 2 of them are mandatory.
Mandatory fields are:

ExportedId: The table or collection id you want to export

Type: The export type. As it is excel here it should be excelHTML

I have provided values for other two optional  fields :

filename: I wanted that the file name should be Employee.xls

title: I wanted the title to be here "List of Employees"


Now if I run the page and click the command button "Export Collection" it will export the table data in one Excel Sheet named "Employee.xls"



The title of the sheet should be "List of Employees " as shown below.




Please comment ....... 
If source code is required please email me.

7 comments:

  1. Great...You are lucky that all numeric data starting with non-zero numbers. Enter a value say '00001' in any of the table and export to excel and see that you are getting '00001' or '1' in excel.

    Murali

    ReplyDelete
  2. hello
    excuse me ,I need source code .
    please send for me .
    email : changizi.mohsen@gmail.com

    ReplyDelete
  3. Hi Moinak,

    I need source code can you please fwd to my id:mani.pala744@gmail.com

    ReplyDelete
  4. Hi

    I'm try to convert ADF collection data in to excel but <af:exportCollectionActionListener exportedId="" what can I given the export id.

    Please provide the information.

    ReplyDelete
  5. Exportedid should be the id of the Table whose data you want to export.

    ReplyDelete
  6. Greatly appreciate that you could send the source code. Thanks. dmslicer@yahoo.com

    ReplyDelete
  7. Great, can you send your source code for me. dougza@msn.com

    ReplyDelete