FileStream file = new FileStream(@"C:\test.xls", FileMode.Open, FileAccess.ReadWrite);
HSSFWorkbook wrkBook = new HSSFWorkbook(file);
ISheet ws = wrkBook.GetSheetAt(1);
IRow r = ws.GetRow(20);
ICell c = r.GetCell(3);
c.SetCellValue("ABC");
wrkBook.Write(file);
file.Close();
Here I am getting the error "Cannot access closed file" at line " wrkBook.Write(file);" .
Can anyone please help me ?
HSSFWorkbook wrkBook = new HSSFWorkbook(file);
ISheet ws = wrkBook.GetSheetAt(1);
IRow r = ws.GetRow(20);
ICell c = r.GetCell(3);
c.SetCellValue("ABC");
wrkBook.Write(file);
file.Close();
Here I am getting the error "Cannot access closed file" at line " wrkBook.Write(file);" .
Can anyone please help me ?