Question

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.

Was it helpful?

Solution

OTHER TIPS

template.Write(new FileStream("c:/path", FileMode.Create, FileAccess.ReadWrite));

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top