Phil,
This code I got working yesterday is pasted below. It adds no lines
and not doctype header. One of the tricks is to use <cfloop query="CSV">
instead of <cfoutput query="CSV">. Put your <cfoutput> inside the loop.
<cfoutput query="CSV"> adds spaces every loop.
<cfsetting enablecfoutputonly="Yes">
<cfquery name="friend" datasource="news" username="news" password="news">
Select * from send_friend where studio = 'no'
</cfquery>
<cfset TabChar = Chr(9)>
<cfset NewLine = Chr(13) & Chr(10)>
<cfcontent type="application/msexcel">
<cfheader name="Content-Disposition" value="filename=all_orders.xls">
<cfoutput query="friend">
#friend.edition##tabchar#
#friend.senders_name#
</cfoutput>
Brian Knott
-----Original Message-----
From: Phil Evans [mailto:[EMAIL PROTECTED]
Sent: Friday, 4 April 2003 10:48 AM
To: CFAussie Mailing List
Subject: [cfaussie] RE: CFCONTENT Tag Disabled by ISP
Hey Lindsay,
Your code works (well very nearly almost).
Thanks again for your help.
I've got
<CFSETTING ENABLECFOUTPUTONLY="Yes">
<CFSILENT>
...
<CFHEADER NAME="Content-Disposition" VALUE="inline; filename=#myfilename">
<cfheader name="Content-type"
value="application/vnd.ms-excel"/></CFSILENT><cfoutput>">Heading1","Heading2
"
</cfoutput>
<cfoutput query="CSV">"#CSV.field1#","#CSV.field2#"
</cfoutput>
It works well (with IE at least), except that the first line of the
spreadsheet is always
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
and there are another half dozen blank lines before the content that I
specified. My first attempt had a heap more junk, and was improved by adding
cfsetting and cfsilent, but I can't seem to get rid of the last half dozen
extraneous lines. I guess my users will just have to delete those - not a
huge drama I suppose.
If anyone can suggest a way to get rid of the junk at the start of the
spreadsheet, I'm listening...
Thanks,
Phil.
----- Original Message -----
From: "Lindsay Evans" <[EMAIL PROTECTED]>
To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 9:33 AM
Subject: [cfaussie] RE: CFCONTENT Tag Disabled by ISP
>
> > a) Are they being reasonable, or paranoid?
>
> I'd say reasonable, if it's a shared hosting environment.
>
> > b) Can anyone provide reasons as to why is does / does not need to be
> disabled?
>
> Just think of the fun your friendly neigbourhood script kiddie could have
> with:
>
> <cfcontent file="C:\Inetpub\[your site]\index.cfm" deletefile="Yes"/>
>
> I'd imagine there would be some way (using sandboxes or whatever) to
> restrict the use of <cfcontent> etc. to certain directories? ie. just the
> user's home directory.
>
> > c) Assuming I have no joy in getting the tag enabled, does anyone have a
> good workaround for creating and
> > returning info suitable for loading into a spreadsheet?
>
> In theory, you could send a content-type http header using <cfheader>:
> <cfheader name="Content-type" value="application/vnd.ms-excel"/>
>
> But in my (rather limited) experiments, this doesn't work quite as
planned.
>
> I got nothing :)
>
> --
> Lindsay Evans.
> Developer,
> Red Square Productions.
>
> [p] 8596.4000
> [f] 8596.4001
> [w] www.redsquare.com.au
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf Of Phil Evans
> Sent: Friday, April 04, 2003 9:09 AM
> To: CFAussie Mailing List
> Subject: [cfaussie] CFCONTENT Tag Disabled by ISP
>
>
> Hi All,
>
> I have app that is supposed to return a spreadsheet back to the browser.
> Works beautifully on dev PC, with code being
>
> <CFHEADER NAME="Content-Disposition" VALUE="inline;
filename=#myfilename#">
> <CFCONTENT TYPE="application/vnd.ms-excel">...
>
> I loaded it up to a large, central ISP, and then found that the CFCONTENT
> tag was disabled.
> I contacted the ISP, who responded with
>
> "Unfortunately the CFCONTENT tag has been disabled on our shared hosting
> platform by our Senior Technicians, due to security reasons. Unfortunately
> it cannot be enabled."
>
> I need to know
>
> a) Are they being reasonable, or paranoid?
> b) Can anyone provide reasons as to why is does / does not need to be
> disabled?
> c) Assuming I have no joy in getting the tag enabled, does anyone have a
> good workaround for creating and returning info suitable for loading into
a
> spreadsheet?
>
> Thanks,
> Phil.
>
>
> ---
> You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MX Downunder AsiaPac DevCon - http://mxdu.com/
>
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/
---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]
MX Downunder AsiaPac DevCon - http://mxdu.com/