Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
可以在coldfusion中下载文件变量吗?_Coldfusion - Fatal编程技术网

可以在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

使用Coldfusion的
电子表格()
对象,我创建了一个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">