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 ?
Comments: ** Comment from web user: tonyqus **
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 ?
Comments: ** Comment from web user: tonyqus **
Looks weird. Which version are you using? NPOI beta (2.0.1) or beta2 (2.0.5)