使用coldfusion將HTML表格輸出成EXCEL檔案(使用者下載)
Coldfusion 的檔案輸出控制,主要有下面兩個指令 <cfcontent><cfheader> cfcontent 用來告訴瀏覽器等一下要輸出的內容是甚麼格式 cfheader 用來宣告傳輸資料的相關資訊 簡單的輸出測試 saveFileTest.cfm: <cfsetting enablecfoutputonly= "Yes" > <cfcontent type= "application/vnd.ms-excel; charset=big5" > <cfheader name= "Content-Disposition" value= "attachment;filename=ODR10001234567.xls" > <!--- office Excel Format Structure---> <cfoutput> <html xmlns:x= "urn:schemas-microsoft-com:office:excel" > <head> <meta http-equiv= "Content-Type" content= "text/html;charset=big5" > <!--[if gte mso 9]> <xml> <x:ExcelWorkbook> <x:ExcelWorksheets> <x:ExcelWorksheet> <!--- this line names the worksheet ---> <x:Name>訂單狀態</x:Name> <x:WorksheetOptions> <!--- these 2 lines are what works the magic ---> <x:Panes> </x:Panes> </x:WorksheetOptions>