C# NPOI
作者:互联网
如何读取EXCEL修改后保存?
引用Dll
using NPOI.SS.UserModel;
代码:
IWorkbook workbook = WorkbookFactory.Create(importExcelPath); ISheet ISheetsheet = workbook.GetSheetAt(0);//获取第一个工作薄 IRow row = (IRow)sheet.GetRow(0);//获取第一行 sheet.GetRow(1).GetCell(0).SetCellValue(userName); sheet.GetRow(1).GetCell(1).SetCellValue(passWord); using (var fs = File.OpenWrite(importExcelPath)) { workbook.Write(fs);//向打开的这个xls文件中写入数据 }
标签:fs,sheet,C#,importExcelPath,GetRow,NPOI,workbook,using 来源: https://www.cnblogs.com/tangpeng97/p/13061670.html