使用NPOI编辑Excel
Posted jasonbie
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用NPOI编辑Excel相关的知识,希望对你有一定的参考价值。
使用NPOI编辑Excel,如果不能保存,需要存到一个新的文件名:
XSSFWorkbook wb1 = null; using (var file = new FileStream("D:\banding.xlsx", FileMode.Open, FileAccess.ReadWrite)) { wb1 = new XSSFWorkbook(file); } wb1.GetSheetAt(0).GetRow(0).GetCell(0).SetCellValue("Sample"); using (var file2 = new FileStream("D:\banding2.xlsx", FileMode.Create, FileAccess.ReadWrite)) { wb1.Write(file2); file2.Close(); }
以上是关于使用NPOI编辑Excel的主要内容,如果未能解决你的问题,请参考以下文章