G
Guest
Hello,
I want to open an Excel spreadsheet in my ASP.NET/C# page, but the file cannot be found. Here's the code:
<code><snip>
using Excel;
using System.Reflection;
using System.Runtime.InteropServices;
<snip>
private Excel.Application excelApp = new Excel.ApplicationClass();
private void Page_Load(object sender, System.EventArgs e)
{
Excel.Workbook newWorkbook = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
excelApp.Visible=true;
string workbookPath = "c:/BACKUP/test.xls";
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath,0, false, 5,
"", "", false, Excel.XlPlatform.xlWindows, "",true, false, 0, true);
}
When I run that code I get the following error:
System.Runtime.InteropServices.COMException: 'test.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open the file from your list of most recently used files on the File menu, make sure that the file has not been renamed, moved, or deleted.
Any ideas, suggstions or recommendations graciously accepted,
gogoray
I want to open an Excel spreadsheet in my ASP.NET/C# page, but the file cannot be found. Here's the code:
<code><snip>
using Excel;
using System.Reflection;
using System.Runtime.InteropServices;
<snip>
private Excel.Application excelApp = new Excel.ApplicationClass();
private void Page_Load(object sender, System.EventArgs e)
{
Excel.Workbook newWorkbook = excelApp.Workbooks.Add(XlWBATemplate.xlWBATWorksheet);
excelApp.Visible=true;
string workbookPath = "c:/BACKUP/test.xls";
Excel.Workbook excelWorkbook = excelApp.Workbooks.Open(workbookPath,0, false, 5,
"", "", false, Excel.XlPlatform.xlWindows, "",true, false, 0, true);
}
When I run that code I get the following error:
System.Runtime.InteropServices.COMException: 'test.xls' could not be found. Check the spelling of the file name, and verify that the file location is correct. If you are trying to open the file from your list of most recently used files on the File menu, make sure that the file has not been renamed, moved, or deleted.
Any ideas, suggstions or recommendations graciously accepted,
gogoray