打开Excel问题 + 5裤散分
简单问题 ,懒得查了 ,散分+求解
有一excel文件 在服务器上:string strFileName = "aaa.xls";
点击button ,欲读成流,保存至本机 ,string strOutFileName = "bbb.xls";
越简单越好 。 要求有打开/保存/取消那个对话框 ,并且看不见原下载地址,即不支持迅雷等下载工具 。
原来用的是SpreadsheetGear,代码如下
protected void btnExcelOut_Click(object sender, ImageClickEventArgs e)
{
string strFileName = "/aaa/aaa.xls";
SpreadsheetGear.IWorkbook workbook = SpreadsheetGear.Factory.GetWorkbook(Server.MapPath( strFileName ));
strOutFileName = bbb.xls ;
Response.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("Content-Disposition", "attachment; filename=" + strOutFileName );
workbook.SaveToStream(Response.OutputStream, SpreadsheetGear.FileFormat.Excel8);
Response.End();
}
上面写法,excel生成的饼图的示例位置变了 ,原因不明 。