I'm trying to open the excel 2003 file with the version 3.1.1.0 and it gives this error message. Prompt response will be much appreciated.
Server Error in '/EReg' Application.
Invalid file format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Invalid file format.
Source Error:
|
Source File: c:\inetpub\wwwroot\ereg\webform1.aspx.cs Line: 151
Stack Trace:
|
Version Information: Microsoft .NET Framework Version:1.1.4322.2032; ASP.NET Version:1.1.4322.2032
the code is:
private void Excel_Click(object sender, System.EventArgs e)
{
Excel ex=generateFile();
ex.Save(@"C:\shailendra\AlbertaCalc\Copy of Alberta HRCL Refi APR Calculator.xls",FileFormatType.Excel2003 );
}
protected static Excel generateFile()
{
int val1 = 10;
string path = @"C:\shailendra\AlbertaCalc\Copy of Alberta HRCL Refi APR Calculator.xls";
Excel ex = new Excel();
ex.Open(path,FileFormatType.Excel2003);
Worksheet sh = ex.Worksheets["DataSheet"];
Cells cells = sh.Cells;
cells["D27"].PutValue(val1);
return ex;
}