日期:2014-05-16  浏览次数:20410 次

有没有这个按钮实现下载这个功能,在线等
我后台已经写好了一个方法丛数据库查询到相应的信息并利用jxl生成excel表格
我前台可不可以有这样一个按钮,一点击,把这个excel下载下来并自己选择路径
(注意:不是下载当前页面的excel),如果可以怎么实现,我框架用的是webwork,配置文件那里怎么配置?谢谢

------解决方案--------------------
不知道你服务端用的是什么脚本(.net?),我这个给各php的例子

public function download()
{
header( "Content-Disposition: attachment; filename= " ".$this-> _fileName. " "; "); //要下载的文件名
header( "Content-Type: application/vnd.ms-exce ");// 类型设置为ms的excel
header( "Content-Length: " . filesize($this-> _fileName));//文件长度
@readfile( $this-> _filePath ) ));// 读文件并输出

}

你在你的服务端的脚本只要按照这种格式发送http的头信息就可以实现excel文件的下载