首页 > 解决方案 > 如何解决 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;

标签: c#excelasp.net-coreepplus

解决方案


推荐阅读