Hi all.  Hopefully someone here has ran into this problem...

I have an excel exporter type deal. Now before I get alternative suggestions
for how I can do this let me explain how it has to "look" to the client.

I am on a page that shows a table format of query results. There is a little
Excel Icon that I click on to export my results to an XLS file (not csv). A
small window about 2 inches wide, 1 inch across pops up and says "Building
Excel File....Please wait"  so I CFFLUSH that much to the page while it
builds the file and writes it to the server using CFFILE.

Once that file is completely written I then display "Retrieving Data".  This
is where I then through Javascript submit the page to another file called
getfile.cfm.  In getfile.cfm I am using CFCONTENT to retrieve that file back
out of the server and then delete it.

The problem is two things...

1. When I get the pop up box it says I am trying to download a file
"getfile.cfm" Why is it naming the file in the pop up box the name of my CFM
template?  But when I click save as it saves it with the correct name
"myfile.xls". Someone on the macromedia board suggested I put the filename
after the getfile.cfm page as you can see in the code below, and it seems to
fix this problem, but I dont know how stable this is.

2. When I click open instead of save as, it doesnt open. Instead, I get a
second dialog box asking me once again if I want to open or save as. This
time, if I choose open, it does open Excel and I can read the file.  Why
would it give me this pop up twice?

After the file downloads I close the window that originally popped up.
Which also isn't working, but I think that is because CF isn't letting me
process the page anymore after I use CFCONTENT or submit to a new page.
Here is the code I am using...

gen_excel.cfm

<!--- Lots of code up here parsing out the excel sheet and query  blah blah
blah --->

<font id=medium><b> 2. Retrieving Data</b></font>
<form action="getfile.cfm/<cfoutput>#filename#</cfoutput>.xls" method="post"
name="TheForm">
        <input type="hidden" name="filename"
value="<cfoutput>#filename#</cfoutput>.xls">
</form>
<script language="JavaScript">
document.TheForm.submit();
</script>



getfile.cfm
<cfsetting enablecfoutputonly="yes">
<cfparam name="filename" default="download.xls">
<CFHEADER NAME="Content-Type" VALUE="application/unknown">
<CFHEADER NAME="Content-Disposition" VALUE="attachment;
filename=""#Filename#""">
<CFCONTENT TYPE="application/unknown" FILE="#path_to_tempdir##filename#"
deletefile="yes">
<cfsetting enablecfoutputonly="no">

Any help would be greatly appreciated.  The poeple at Macromedia and the
boards and such either don't know or just aren't helpful.

Thanks,
Misty Woodward
BigOSoftware
[EMAIL PROTECTED]
www.BigOSoftware.com
Contact us about our Developer Discount Program
6709 W 119th Street
Suite 422
Overland Park, KS 66209
913-219-2210

 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 

Reply via email to