Couple of Projects that I am working on required to download the data from database in Excel fromat, so that the client can download it on his local system.
One of the efficient way I have found is using Query2Excel Tag which is available FREE on internet. You can download if from www.cflib.org
Below code is just how to call that function, for excel download.
<!--- Query to get information from database --->
<cfquery name="get_info" datasource="#whatever#">
select name1, name2, name3 from yourdatabase
</cfquery>
<!--- give the column names and headers for Excel file --->
<cfscript>
cols = "name1, name2, name3";
heads = "Name1, Name2, Name3"
</cfscript>
<!--- use CFHEADER tag --->
<cfheader name="Content-Disposition" value="inline; filename=data.xls">
<cfcontent type="application/msexcel">
<!--- output the results using the query2excel function --->
<cfoutput> #Query2Excel(get_info, heads, cols)# </cfoutput>
<!--- End of code --->
That's all you need :-)
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(18)
-
▼
July
(8)
- Searching on Google, Really Cool stuff !!!!!
- Jazz, Two Months Old !!!!!!
- FRIENDS All Seasons Download Links !!!!!!!!
- Output Query To CSV file using Coldfusion MX and J...
- How to Parse XML using Coldfusion MX
- How to Output Query In Excel Format Using Coldfusi...
- SQL Server Interview Questions
- ASP.Net Interview Questions
-
▼
July
(8)
No comments:
Post a Comment