Link to home
Start Free TrialLog in
Avatar of mcgrind
mcgrind

asked on

How do I export an html table to excel without ActiveX?

I write in JAVA and have gotten an html table to export to excel using Active X and javascript, but the computer's that are going to be using my export can't use Active X, so I need another way.  My goal is to generate a table, which i have, have an 'export to excel' button, and when it's clicked, transfers the table data to excel for manipulation/saving..etc...any suggestions?
Avatar of Gibu George
Gibu George
Flag of India image

You can do this easily if you use display tag to build the table.
http://displaytag.sourceforge.net/1.2/
Avatar of Ramanhp
Include the following code in the .jsp page that generates the report/HTML page:


      String mimeType = "application/vnd.ms-excel";
      response.setContentType(mimeType);      
fyi..

http://www.devx.com/tips/Tip/21382



String mimeType = "application/vnd.ms-excel";
      response.setContentType(mimeType);  

This will export the entire jsp page to an excel file.

I think mcgrind want only the table in the page to be exported.
The display tag provides you with options to export to excel, which is built into it.
ASKER CERTIFIED SOLUTION
Avatar of Murali Murugesan
Murali Murugesan
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
response.setContentType("application/vnd.ms-excel");
      response.setHeader("Content-disposition","attachment;filename=report.xls");      

just corrected the syntax.