• Post Reply Bookmark Topic Watch Topic
  • New Topic

Export to excel functionality

 
Ammu Chandran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

I have built a html table dynamically from javascript function and I have exported this table content to a excel spread sheet onclick of a link in xhtml page.Problem I have here is,I dont find download popup with options like open,save or cancel before excel export and the table is getting exported to a excel sheet directly.Can anyone of you tell me,how to add this download popup?

Note:I am not sending this html table content to a servlet and I am doing all the processing at the client side.
 
amit punekar
Ranch Hand
Posts: 544
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
As far as I understand you will need to do the following when user clicks on "Export" button -
1) Invoke a servlet that would write CSV format data on the response
2) Set the content-type to MS-Excel (please check the exact content-type to be set)

For #1, you also use APACHE POI apis to generate the excel spreadsheet at server side and write it onto the Response stream.

Regards,
Amit
 
Ammu Chandran
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amit,
Since my project uses AJAX,I have made async request to a servlet and from the servlet I have built the html table by iterating the result set and appended it to a string builder and set the content type to application/vnd.ms-excel.But I am not getting any output for it.
Please help me to proceed further....

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!