文件读取错误Please set the ExcelPackage.LicenseContext property. see https://epplussoftware.com/developers
报错:
文件读取错误Please set the ExcelPackage.LicenseContext property. see https://epplussoftware.com/developers/licenseexception
解决方案:
使用的是 EPPlus 5.0.4 或更高版本,因此需要设置 ExcelPackage.LicenseContext 属性来避免许可证错误。(在 应用程序引用了正确的NuGet包,即EPPlus 的前提下)即:在设置属性之前,先引入 System.ComponentModel 命名空间,然后在窗体的构造函数中设置 ExcelPackage.LicenseContext 属性为 LicenseContext.NonCommercial,即可解决该问题。
ExcelPackage.LicenseContext = OfficeOpenXml.LicenseContext.NonCommercial;
根据你所使用的 EPPlus 版本的许可证类型,也可以将其设置为 LicenseContext.Commercial。
还没有评论,来说两句吧...