WeihanLi.Npoi 1.20.0 Released

WeihanLi.Npoi 1.20.0 Released

Intro

WeihanLi.Npoi 是一个基于 netstandard2.0 的一个 NPOI 扩展库,主要用于导入导出 Excel 以及CSV,支持通过 Fluent API 的方式来支持非常灵活的导入导出配置,详细使用可以参考文档介绍以及项目示例

Updates

最近我自己没什么更新,主要是一个外国小哥提了三个 PR,主要改进了 Excel 文件导入成一个 DataTable,对应的 API 是 ExcelHelper.ToDataTable

最近针对 DataTable 的改进都是基于导入一个别的地方生成的一个 excel 文件,如果你是 DataTable 使用这个库导出的话再导入是不会有问题的,主要更新如下:

Bug fix:

  • 修复导入的 Excel 文件表头单元格格式不是 string 时数据处理异常的 BUG https://github.com/WeihanLi/WeihanLi.Npoi/pull/120

  • 修复导入的 Excel 文件存在空列时可能会导致数据不对的 BUG https://github.com/WeihanLi/WeihanLi.Npoi/pull/118

Features:

  • ExcelHelper.ToDataTable API 增加 bool removeEmptyRows = false, int? maxColumns = null 参数,支持移除空行和指定最大导入行数https://github.com/WeihanLi/WeihanLi.Npoi/pull/123

    DataTable ToDataTable(byte[] excelBytes, ExcelFormat excelFormat, bool removeEmptyRows = false, int? maxColumns = default);
    
    DataTable ToDataTable(byte[] excelBytes, ExcelFormat excelFormat, int sheetIndex, bool removeEmptyRows = false, int? maxColumns = default);
    
    DataTable ToDataTable(string excelPath, int sheetIndex, int headerRowIndex, bool removeEmptyRows = false, int? maxColumns = default);
    
  • 作为对于 1.18.0 版本中引入的 MappingProfile feature 的改进(可以参考 WeihanLi.Npoi 1.18.0 Released),增加了几个 API 来简化 MappingProfiler 的注册

    FluentSettings.LoadMappingProfile<TestEntity, TestEntityExcelMappingProfile>();
    
    FluentSettings.LoadMappingProfile<TestEntityExcelMappingProfile>();
    
    FluentSettings.LoadMappingProfile(new TestEntityExcelMappingProfile());
    

More

看提 PR 小哥的 Github 资料,是来自捷克共和国,布拉格的一位工程师

小哥非常认真,提交的每一个 PR 都对应提供了完善的单元测试用例,真的非常赞,为小哥点赞 :thumbsup:,感谢小哥的贡献

我们如果在对开源项目做贡献的时候,应该向这位小哥学习,也应该尽可能地在修复 BUG 或者贡献新功能的同时提供对应的测试用例以构建更为健壮和高质量的开源项目

References

  • https://github.com/WeihanLi/WeihanLi.Npoi

  • https://weihanli.github.io/WeihanLi.Npoi/index.html

  • https://weihanli.github.io/WeihanLi.Npoi/docs/articles/intro.html

  • https://github.com/WeihanLi/WeihanLi.Npoi/pull/118

  • https://github.com/WeihanLi/WeihanLi.Npoi/pull/120

  • https://github.com/WeihanLi/WeihanLi.Npoi/pull/123

  • WeihanLi.Npoi 1.18.0 Released

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值