Export to Excel, via a Link on action page
I have two questions.
1) How can I export to excel, via a link. So for example I have a form and a user clicks submit and I cfoutput the data in a table on the same page (action page is the same as the input page). Now, once the data is output, I would like a link on that same page so the user can click and it will export the table to Excel.
I have tried:
<cfheader name="Content-Disposition" value="attachment; filename=test.xls">
<cfcontent type="application/msexcel">
<cfoutput query="qTest">
<table>
<tr>
<th>Account</th>
<th>Amount</th>
</tr>
<tr>
<td>#qTest.ACCOUNT#</td>
<td>#NumberFormat('#qTest.TotalAmt#', "_(999,999,999.99)")#</td>
</tr>
</table>
</cfoutput>
But once the page is loaded it tries to export automatically. How can I get it to export via a link?
Also, someone suggested wrapping the cfoutput in a <cfsavecontent variable="xyz"> tag, but once I do that, how do I put the "xyz" variable into the <cfcontent> tag? Or where do I use it?
Thanks guys
