|
| Submitted on: |
8/5/2008 4:25:48 PM |
| By: |
Tim Garver
|
| Level: |
Beginner |
| User Rating: |
By 5 Users |
| Compatibility: |
Cold Fusion MX |
| Views: |
64742 |
|
(About the author) |
|
|
|
Output excel file easy with ColdFusion MX.
Hi Many years ago i wrote an article here to create an excel CSV file with ColdFusion.
I wanted to update this with the newer easier way to accomplish the same goal.
have a search page with an output type drop box called "otype" values("web","xls","prt")
Write out your page in an HTML table with the columns you want in excel.
Then put an IF statement around your table or simply at the bottom of the page with links to the same page with the otype or a form that submits to the same page with the otype var.
then use this code:
|
| |
Terms of Agreement:
By using this article, you agree to the following terms...
- You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
- You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
- You may link to this article from another website, but ONLY if it is not wrapped in a frame.
- You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
|
<cfif #form.otype# EQ "xls">
<cfheader
name="Content-Type"
value="application/msexcel">
<cfheader
name="Content-Disposition"
value="attachment; filename=MyReport.xls">
<cfelseif #form.otype# EQ "prt">
<cfheader
name="Content-Type"
value="application/msword">
<cfheader
name="Content-Disposition"
value="attachment; filename=MyReport.doc">
</cfif>
Thats it, very simple and when the link is clicked or form is submited, the user will be asked to download the Excel file.
|
|
Other 11 submission(s) by this author
|
|
Report Bad Submission
|
Your Vote
|
| |
Other User Comments
|
7/24/2008 5:22:10 AM: query to excell
gf (If this comment was disrespectful, please report it.)
|
9/3/2008 3:43:11 PM: omar
ingreso nuevo (If this comment was disrespectful, please report it.)
|
11/8/2008 12:08:22 AM: ardhi
penting bgt niy. (If this comment was disrespectful, please report it.)
|
2/11/2009 10:13:21 PM: paresh
it is good (If this comment was disrespectful, please report it.)
|
2/23/2009 11:22:16 PM: saeba
can give me same matery
(If this comment was disrespectful, please report it.)
|
8/10/2009 11:35:53 PM: aaa
ffgefge (If this comment was disrespectful, please report it.)
|
9/21/2010 6:46:49 AM: Hari
Good Artcle
(If this comment was disrespectful, please report it.)
|
12/27/2010 9:05:58 AM: pilipara.dakajaska
good (If this comment was disrespectful, please report it.)
|
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)
To post feedback, first please login.
|