【发布时间】:2014-03-06 12:03:56
【问题描述】:
在进行更改后,我使用 Interop 将模板 Excel 表另存为(D:/Temp)。
然后我使用FileStream 向用户发送一个弹出窗口来保存这个文件。但是 D:\Temp 中的那个文件仍然存在。
有没有办法在弹出响应中删除此文件?
//Save the Excel File
SaveExcelFile(exportPath, sourceFile, excelWorkBook,
excelApllication, excelWorkSheet);
#region Pop Up and File Open
if (System.IO.File.Exists(sourceFile))
{
FileStream fsSource =
new FileStream(sourceFile, FileMode.Open, FileAccess.Read);
return File(fsSource, "application/vnd.ms-excel", "FileName" + .xls");
}
else
{
return View();
}
#endregion
【问题讨论】:
标签: c# asp.net-mvc filestream