Huge memory Allocation when using EPPlus Excel Library

前端 未结 2 850
一整个雨季
一整个雨季 2021-01-12 17:37

Context

I have been using EPPLUS as my tool to automate excel report generation, using C# as the client language of the library.

Pro

相关标签:
2条回答
  • 2021-01-12 18:06

    As I've encountered this too, and found no real solution, I've had to come up with the solution by myself. It comes as a new library: https://github.com/danielgindi/SpreadsheetStreams.net

    This is based on taking a very old piece of code of mine, that supported csv and xml, refactor the interface, add xlsx support, and publish as a standalone library.

    This is not a replacement for EPPlus or other spreadsheet manipulation libraries, this one is just about streaming generation of reports. Not all excel features are there also.

    0 讨论(0)
  • 2021-01-12 18:29

    Modern Excel files, ie, Xlsx files are zip-compressed, and often achieve compression down to 10%. I just uncompressed a 1.6MB file I generated using a similar tool and found it extracted to 18.8 MB of data.

    You've got a 0.138 GB file that is using 1.370 GB of memory, which is almost exactly 10%. The uncompressed representation in memory is what is eating your memory.

    If you're curious, you can use a tool like 7-Zip to extract the Xlsx files, or you can rename the file to end in .zip and browse it in Windows.

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