tigerpuzzle
tigerpuzzle

Reputation: 69

ColdFusion - Open with Excel output

I have following ColdFusion code to open the file with Excel format.

<CFCONTENT TYPE="text/tabdelimited">
<CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=""SpendRptFromAPPayments-kfs_#DateFormat( Now(), "yyyymmdd" )##TimeFormat( Now(), "HHmmss" )#.xls""">
<CFOUTPUT>#Request.QueryName# - #Request.QueryID#</CFOUTPUT>
Total Amount
<CFOUTPUT Query="SpendAPPmt">
#DollarFormat(totalValue)##chr(10)#
</CFOUTPUT>

I have Excel 2013 at my computer. On open prompt screen, how to change 'which is: Adobe ColdFusion File' to 'which is: Microsoft Excel Worksheet'

Actual Result

I want to change the setting on 'which is' to make it to be 'Microsoft Excel Worksheet'.

Desired Result

Upvotes: 0

Views: 2673

Answers (1)

Anit Kumar
Anit Kumar

Reputation: 1228

You need to set the content type as vnd.ms-excel

<cfheader name="Content-Disposition" value="inline; filename=foo.xls"> 
        <cfcontent type="application/vnd.ms-excel" file="C:\foo.xls">

If it still gives the same error, then you probably need to change the windows default program. Please refer to http://windows.microsoft.com/en-in/windows/change-default-programs

Upvotes: 2

Related Questions