文件读取错误Please set the ExcelPackage.LicenseContext property. see https://epplussoftware.com/developers

Dear 丶 2023-10-13 19:33 38阅读 0赞

报错:

文件读取错误Please set the ExcelPackage.LicenseContext property. see https://epplussoftware.com/developers/licenseexception

f806a9e52d4341f2a6ff52f5027c54a2.png

解决方案:

使用的是 EPPlus 5.0.4 或更高版本,因此需要设置 ExcelPackage.LicenseContext 属性来避免许可证错误。(在 应用程序引用了正确的NuGet包,即EPPlus 的前提下)即:在设置属性之前,先引入 System.ComponentModel 命名空间,然后在窗体的构造函数中设置 ExcelPackage.LicenseContext 属性为 LicenseContext.NonCommercial,即可解决该问题。

  1. ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;

230754341eae4480a9da768cd509c2f1.png

根据你所使用的 EPPlus 版本的许可证类型,也可以将其设置为 LicenseContext.Commercial。

发表评论

表情:
评论列表 (有 0 条评论,38人围观)

还没有评论,来说两句吧...

相关阅读

    相关 读取Properties配置文件

    通过读取properties文件获取配置项的值在开发中是很常用的,这种方式降低了变量和代码间的耦合,使得非开发人员也可以很容易的对系统的一些配置进行修改,比如配置数据库连接参数