0
我正在使用Excel Helper类生成Excel数据表中的每个数据表作为excel中的工作表。HTTP响应 - Excel文件 - 保存到磁盘
我能够获得多个工作表的excel,但有什么方法可以直接从代码保存到一个位置。
由于excel直接下载,当我运行的代码,我不得不手动保存它。请告知。
public static void ToExcel(DataSet dsInput, string filename, HttpResponse response)
{
var excelXml = GetExcelXml(dsInput, filename);
response.Clear();
response.AppendHeader("Content-Type", "application/vnd.ms-excel");
response.AppendHeader("Content-disposition", "attachment; filename=" + filename);
response.Write(excelXml);
response.Flush();
response.End();
}
Using the helper class to genrate Dataset into multiple tabs //
try
{
ds = obj.Get_Tables();
}
ExcelHelper.ToExcel(ds, "AlertDetails.xls", Page.Response);