I am using the following code to edit cells of an excel file but I dont see my changes in the escel file.
using (var fs = new FileStream(reconnFileName, FileMode.Open, FileAccess.ReadWrite))
{
HSSFWorkbook template = new HSSFWorkbook(fs, true);
ISheet sheet = template.GetSheetAt(0);
int rownumber=3;
foreach(StringBuilder cardHolderValue in cardHolderValues)
{
sheet.GetRow(rownumber).Cells[2].SetCellValue(cardHolderValue.ToString());
rownumber++;
}
}
And I can't find any Save()
function in it to do so. Please let me know how can I save my edits.
Look at: http://dotnetslackers.com/articles/aspnet/Create-Excel-Spreadsheets-Using-NPOI.aspx#s7-conclusion. There is a Write method to save your excel file.