EPPlus error reading file

前端 未结 2 588
庸人自扰
庸人自扰 2021-01-29 15:01

using code like

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


        
相关标签:
2条回答
  • 2021-01-29 15:17

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

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

    and in your startup.cs

    add

    System.Text.Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
    
    0 讨论(0)
  • The problem is in the ZIP file reader (ZipInputStream). You need to add the encodings like windows-1252 manually:

    1. dotnet add package System.Text.Encoding.CodePages

    2. Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

    More info here: .NET Core doesn't know about Windows 1252, how to fix?

    0 讨论(0)
提交回复
热议问题