You will need to look at the cfcontent and cfheader tags to achieve this.

-- 
Regards,
Andrew Scott
WebSite: http://www.andyscott.id.au/
Google+: http://plus.google.com/108193156965451149543



-----Original Message-----
From: Mo Lay [mailto:[email protected]] 
Sent: Wednesday, 7 September 2011 5:59 AM
To: cf-newbie
Subject: export to Excel file


Hi Peers,
 i am using the following statement to save query result into excel file and
save it into given folder : c:\temp 


my question is how can i have the file generated and opened instead of being
saved ?

thanks


here is a part of  my code :


<cfquery name="qReport" datasource="#dsn#">

        
     SELECT  T1.USERID 
                ,T1.FIRSTNAME 
            ,T1.LASTNAME 
            ,T1.EMAIL 
            ,T1.PASSWORD 
            ,T1.USERNAME 
            ,T1.TID 
     FROM LAYACHMO.USERS T1
      


</cfquery>

<cfsavecontent variable="report">
<cfoutput>
        <table border="1">
                <thead align="center">
                        <th>USERID</th>
                        <th>FIRSTNAME</th>
                        <th>LASTNAME</th>
                        <th>EMAIL</th>
                        <th>PASSWORD</th>
                        <th>USERNAME</th>
            <th>TID</th>
                </thead>
                <cfloop query="qReport">
                <tr align="left">
                        <td>#USERID#</td>
                        <td>#FIRSTNAME#</td>
                        <td>#LASTNAME#</td>
                        <td>#EMAIL#</td>
                        <td>#PASSWORD#</td>
                        <td>#USERNAME#</td>
            <td>#TID#</td>
                </tr>
                </cfloop>
        </table>
</cfoutput>
</cfsavecontent>
<cffile action="write"
file="C:\Temp\Repot#DateFormat(Now(),'ddmmyyyy')#_#LSTimeFormat(Now(),'HHMMS
S')#.xls" output="#report#">

<cfoutput>

Hi,<br/><br/>

Your report has been generated successfully and stored in the following
location c:/Temp.<br/><br/>

Thank you <br/>

</cfoutput>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-newbie/message.cfm/messageid:5528
Subscription: http://www.houseoffusion.com/groups/cf-newbie/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-newbie/unsubscribe.cfm

Reply via email to