可以在coldfusion中下载文件变量吗?
使用Coldfusion的可以在coldfusion中下载文件变量吗?,coldfusion,Coldfusion,使用Coldfusion的电子表格()对象,我创建了一个excel文件,现在用户需要能够下载它 mySS = SpreadsheetNew(); format1 = StructNew(); format1.color="dark_green"; format1.size="24"; SpreadSheetSetCellValue(mySS, 7,2,3); SpreadSheetFormatCell(mySS, format1, 2, 3); 基本上我想要 <cfdownload v
电子表格()
对象,我创建了一个excel文件,现在用户需要能够下载它
mySS = SpreadsheetNew();
format1 = StructNew();
format1.color="dark_green";
format1.size="24";
SpreadSheetSetCellValue(mySS, 7,2,3);
SpreadSheetFormatCell(mySS, format1, 2, 3);
基本上我想要
<cfdownload var="#mySS#">
我的错误是,我是不是遗漏了什么
coldfusion.excel.ExcelInfo不是受支持的变量类型。这个
变量应包含二进制数据
尝试:
您可能还需要设置type属性,以便浏览器知道它不是HTML。好的,感谢和speshak,这里是最终的解决方案
<cfheader name="Content-Disposition" value="attachment;filename=filename.xls">
<cfcontent variable="#spreadsheetReadBinary(mySS)#" type="application/msexcel">
<cfheader name="Content-Disposition" value="attachment;filename=filename.xls">
<cfcontent variable="#spreadsheetReadBinary(mySS)#" type="application/msexcel">