本地工作很好:
Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
Application excel = null;
Workbook wb = null;
excel = new Application();
excel.Visible = false;
excel.DisplayAlerts = false;
excel.AlertBeforeOverwriting = false;
wb = excel.Workbooks.Open(Server.MapPath(fileName), Type.Missing, false,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing);
wb.Save();
wb.Close(false, null, null);
excel.Quit();
在服务器Windows 7 Ultimate x64上发布后,我遇到了这个问题:
Microsoft Office Excel cannot access the file: ///
There are several possible reasons: • The file name or path does not exist. • The file is being used by another program. • The workbook you are trying to save has the same name as a currently open workbook.
如何解决这个问题: