Using EPPlus with a MemoryStream

后端 未结 8 1126
离开以前
离开以前 2020-12-05 06:05

I am using EPPlus to generate an XLSX file in C#. As soon as I instantiate the ExcelPackage with a memory stream - I get the error:

\"A disk error occ

8条回答
  •  心在旅途
    2020-12-05 06:49

    I was dealing with the same error, but none of the other answers provided any help.

    In the end, the problem was solved after adding this code before trying to open the file:

    Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
    

    It seems that the root cause was that EPPlus could not open the ZIP because of a missing code page. I got this to work thank to this StackOverflow answer.

提交回复
热议问题