毕业那天我们失业,广西浦北天天网,太湖字谜彩酷酷caikuku
因为前一段时间需要处理一些 excel 数据,主要是导入/导出操作,将 excel 数据转化为对象再用程序进行处理和分析,没有找到比较满意的库,于是就自己造了一个轮子,屏蔽掉了 xlsx 与 xls 的差别,屏蔽了 npoi 操作 excel 的细节,提供简单容易上手的 api。
直接添加 nuget 包引用 weihanli.npoi
根据 excel 文件获取一个 iworkbook
对象,支持 *.xls/*.xlsx
iworkbook workbook = excelhelper.loadexcel("excelfilepath");
将 excel 文件的第一个 sheet 里的内容转成 list 对象
list<tentity> entitylist = excelhelper.toentitylist<tentity>("excelfilepath");
将 excel 文件的第一个 sheet 里的内容转成 datatable 对象
datatable datatable = excelhelper.todatatable("excelfilepath");
将 list 对象导出到 excel 字节数组
list<tentity> entitylist = excelhelper.toentitylist<tentity>("excelfilepath"); entitylist.toexcelbytes();
将 list 对象导出到 excel 文件
list<tentity> entitylist = excelhelper.toentitylist<tentity>("excelfilepath"); entitylist.toexcelfile("excelfilepath");
如果使用过程中有遇到什么问题,欢迎与我联系。
contact me:
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论