无法从Intranet上的客户端计算机打开ms-excel表单
我用c#创build了一个asp.net网站。 点击该button后,网页中的值将被存储到系统的Excel表格中。
这在本地完成时工作正常,但是当从客户端机器访问内部网时,它显示一个错误:
"file path is invalid or the file is already open"
如何使Excel表打开并将数据保存在客户机中?
我的代码:
Excel._Application myExcelApp; Excel.Workbooks myExcelWorkbooks; Excel.Workbook myExcelWorkbook; // Excel ._Worksheet myExccelWorksheetToChange; object misValue = System.Reflection.Missing.Value; myExcelApp = new Excel.Application(); myExcelApp.Visible = true; myExcelWorkbooks = myExcelApp.Workbooks; String fileName = "D:\\marks.xlsx"; myExcelWorkbook = myExcelWorkbooks.Open(fileName, 0, true, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true); // string name = System.IO.Path.GetTempPath()+Guid.NewGuid().ToString()+".xlsx"; Excel.Worksheet myExcelWorksheet = (Excel.Worksheet)myExcelWorkbook.ActiveSheet; // myExcelWorksheet.SaveAs("marks"); String cellFormulaAsString = myExcelWorksheet.get_Range("A2", misValue).Formula.ToString(); myExcelWorksheet.get_Range("A1", misValue).Formula = TextBox1.Text;