EPPlus错误读取文件 [英] EPPlus error reading file

查看:88
本文介绍了EPPlus错误读取文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用

using OfficeOpenXml;  // namespace for the ExcelPackage assembly
…
FileInfo newFile = new FileInfo(@"C:\mynewfile.xlsx"); 
using (ExcelPackage xlPackage = new ExcelPackage(newFile)) { … }

我收到

'IBM437'不是受支持的编码名称.有关定义的信息 自定义编码,请参见 Encoding.RegisterProvider方法.参数名称:名称

'IBM437' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method. Parameter name: name

关于可能是什么问题的任何想法?

Any ideas as to what the problem could be?

谢谢 马丁

推荐答案

如果您的项目是.net核心,请编辑您的项目文件,然后添加

if your project is .net core edit your project file then add

<ItemGroup>
<PackageReference Include="System.Text.Encoding.CodePages" Version="4.3.0" />
</ItemGroup>

并在您的startup.cs

and in your startup.cs

添加

System.Text.Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

这篇关于EPPlus错误读取文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆