Epplus 8+ 之后非商業許可證的設置變了如果還用普通的方法會報錯
Unhandled exception. OfficeOpenXml.LicenseContextPropertyObsoleteException: Please use the static ‘ExcelPackage.License’ property to set the required license information from EPPlus 8 and later versions. For more info see http://epplussoftware.com/developers/licensenotsetexception.
at OfficeOpenXml.ExcelPackage.set_LicenseContext(Nullable`1 value)
at Program.$(String[] args) in D:\Study\Rider\WorkSpace\Test\GetFieldNoSame\Program.cs:line 52
這個時候需要使用
ExcelPackage.License.SetNonCommercialOrganization("My Noncommercial organization");//組織
//或者
ExcelPackage.License.SetNonCommercialPersonal("My Name");//個人
括號里的字符串可以隨意填
下面是官方網站給出的代碼,上面是組織下面是個人。都是非商業的許可。