Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Save page data to Excel 1

Status
Not open for further replies.

SilverStray

Programmer
Oct 25, 2001
47
AU
I am trying to save data I extracted from a bean to Excel. The bean is an ArrayList and I displayed its content on my page. I also have a button, which I hope, when clicked, will save the data to Excel. I tried to put the following function called by this button, but I don't think I'm getting it right because the Save to Excel popup window went on even before I clicked the button.

function download(){
<%@ page contentType = &quot;application/vnd.ms-excel&quot; %>
<% response.setContentType(&quot;application/vnd.ms-excel&quot;); %>
<% response.setHeader(&quot;Content-disposition&quot;,&quot;attachment;filename=_filename.xls&quot;); %>
window.document.form1.submit();
}

What is the proper way for me to get on with is? I hope you can help me.

Thanks in advance!

-joni
 

You can only do this client-side in IE, and then only if you allow ActiveX objects to run. Is this OK for you?

Server-side, I'm sure there are many ways of achieving it (from writing a CSV file, XLS file, etc), but that's for somebody else to answer ;o)

Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top