• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

excel download

New Here ,
Feb 26, 2007 Feb 26, 2007

Copy link to clipboard

Copied

Hi i have a query which displays a fairly big records list, i need to have a excel download of this list, what would be the best way of doing this?

will i need to save the file first on to my server then call it as a download ? if so how do i save the file from a query?

i know how to call it as a download
TOPICS
Advanced techniques

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

You can display the query results in excel dynamically by using the followingat the top of the web page:

<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="filename=NAME_OF_YOUR_FILE.xls">
<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns=" http://www.w3.org/TR/REC-html40">

This will allow a message to appear to save the file with a devault of "NAME_OF_YOUR_FILE.xls"
Place the queried data in a <Table> structure and there you go.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

ko i am using

<cfheader name="Content-Disposition" value="inline; filename=acmesales03.xls">
<cfcontent type="application/vnd.ms-excel">

but this just opens up excel and displays the output,, i do not get a save as option

what i need is not to display but to have a download, save as option

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

Hi many thanks that does work but the query is massive so it takes the browser hours to procees the query,

is there a way of getting the server to save the file to the server, then do a download from there

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

Hi,

Try this UDF "Query2Excel",

http://www.cflib.org/udf.cfm?ID=560


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

Change to value=attachment:

<cfheader name="Content-Disposition" value="attachment; filename=acmesales03.xls">
<cfcontent type="application/vnd.ms-excel">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

You can save the file to the server and e-mail it as an attachment. You can also to this as a scheduled job.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

ok but how do i save the file to the server? have you got any example code

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

quote:

Originally posted by: RyanG24
ok but how do i save the file to the server? have you got any example code

Maybe I spoke too soon.

It it meets your requirements you could save it as a .csv file which opens with excel. You can use cffile to write that file.

Otherwise, it gets hard. You have to use a com object or something else that is beyond my level of expertise.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

If you're on CFMX 7, I've had good luck with the poiutility.cfc and the
poi.2.5.1 jar to make excel files. I'm not sure how it does with large
recordsets.
http://www.bennadel.com/index.cfm?dax=blog:474.view
hth
--
Tim Carley
www.recfusion.com
info@NOSPAMINGrecfusion.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

hi yes i am using cfm 7, if you view this link below, this is a small version of what i need the excel formated like, will this poiutility.cfc be able to do this?

http://www.southerncooling.com/AAResults1.cfm

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Feb 27, 2007 Feb 27, 2007

Copy link to clipboard

Copied

LATEST
Well...the cfc can do some formatting of rows and data, coloring, data
types, etc....I don't know about a header spanning columns...haven't
tried that. It does export to worksheets, which is the downside of the
html table export format. You can always add whatever methods you need
from the jar/java object...if your so inclined (not too hard
really...just time.) The link I posted in my last post has several links
in it...no sense in reinventing the wheel.
hth
--
Tim Carley
www.recfusion.com
info@NOSPAMINGrecfusion.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation