c# - 如何解决 EPPlus 读取大 Excel 文件的问题
问题描述
我有大的 excel 文件,比如 10K 行和 17 列的 excel 文件。我用 EEPlus 尝试了 500 行 excel 文件并成功读取。但是,当我尝试使用大型 excel 文件时,我遇到了这个错误。
错误图片: http ://hizliresimyukle.com/images/2019/01/13/e1.jpg
错误消息: OfficeOpenXml.Packaging.Ionic.Zip.BadReadException:'无法读取块 - 没有数据!(位置 0x003C712B)'
代码:
string sWebRootFolder = _hostingEnvironment.WebRootPath;
string sFileName = fileName;
ImportClass imp = new ImportClass();
FileInfo file = new FileInfo(Path.Combine(sWebRootFolder, sFileName));
List<string> header = new List<string>();
using (ExcelPackage package = new ExcelPackage(file))
{
var worksheet = package.Workbook.Worksheets.FirstOrDefault();
int rowCount = worksheet.Dimension.Rows;
int ColCount = worksheet.Dimension.Columns;
解决方案
推荐阅读
- opencv - 针对传送带上的盒子的 OpenCV 特征匹配算法建议
- http - 如何设置多个 HTTP cookie
- java - 在 Java 中使用正则表达式获取 URL 中的值
- javascript - 返回“响应”对象或元组的模式的名称
- c# - 异步 ServiceBusTrigger 的好处
- c# - HierarchicalDataTemplate 中的 WPF TreeView 过滤器项
- python - 如何在没有错误的情况下标记推文列表?
- wordpress - 如何导出带有帖子信息的 WordPress 评论
- java - 如何使用 apache spark 流和 Java API 从所有人中获取英文推文?
- security - 是否可以通过 XSS 漏洞执行 SQL 注入?