Hi !
I get an exception error " ERROR: Could not find a part of the path 'C:\Program Files\Common Files\Microsoft Shared\DevServer\test\Book3.xls'."
The code used is-
try
{
FileUpload1.SaveAs(Server.MapPath("/test/" + FileUpload1.FileName));
Label1.Text = "File name: " +
FileUpload1.PostedFile.FileName + "<br>" +
FileUpload1.PostedFile.ContentLength + " kb<br>" +
"Content type: " +
FileUpload1.PostedFile.ContentType;
//initialize a new Workbook object
Workbook workbook = new Workbook();
//open an excel file
workbook.LoadFromFile(@"..\test\Book3.xls");
//get the first worksheet
Worksheet sheet = workbook.Worksheets[0];
//delete the twelfth row of the first sheet
sheet.DeleteRow(1);
//delete the second column of the first sheet
// sheet.DeleteColumn(2);
//save the excel file
workbook.SaveToFile("Book3.xls", ExcelVersion.Version2007);
//launch the excel file
System.Diagnostics.Process.Start(workbook.FileName);
}
catch (Exception ex)
{
Label1.Text = "ERROR: " + ex.Message.ToString();
}
I even tired Server.MapPath but got the same error.
Excel sheet is attached
Please let me know how can i solve this problem.