string path=Server.MapPath("../ExcelTemplate/DownloadExcelFiles/FacilitySetup" + ss + ".xls");
log.append("Mapped Path"+path, 100);
log.append("Start to SaveAs Worksheet", 100);
try
{
ThisWorkBook.SaveAs("" + Server.MapPath("../ExcelTemplate/DownloadExcelFiles/FacilitySetup" + ss + ".xls") + "", Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, missing, missing, false, false, Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange,
missing, missing, missing, missing, missing);
//ThisWorkBook.SaveAs(path, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, missing, missing, false, false,
// Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlNoChange, missing, missing, missing, missing, missing);
}
catch (Exception exceptionObj)
{
log.append("Exception During SaveAs" + exceptionObj.ToString(),100);
}
log.append("Worksheet SaveAs Successfully", 100);
笔记:
- 部分代码示例如上所示
- 我正在尝试下载excel文件
- 文件正常下载,但是当我在 IIS 服务器上运行相同的应用程序时,没有下载 excel 文件。
- 我在每一行都维护了日志
- 我在运行行(saveAs())期间发现正常执行不会进入下一行
- 即在 saveAs() 上出现问题
如何解决?