Shaman.EPPlus + ASP.NET Core MVC - Part already exist exception

后端 未结 1 1323
我寻月下人不归
我寻月下人不归 2021-01-06 01:34

I am using Shaman.EPPlus, a version of EPPlus that should be compatible with ASP.NET Core MVC. I am trying to export a collection of object as xlxs file. The code looks like

相关标签:
1条回答
  • 2021-01-06 02:13

    The problem are these line:

    pck.Save();
    ....
    var bytes = pck.GetAsByteArray();
    

    Both calls will cause the package to be closed by Epplus. You do not need the .Save call since that will automatically be called by .GetAsByteArray anyway so simply remove the first line.

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