문제

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.

도움이 되었습니까?

해결책

다른 팁

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top