the zip archive does not support reading csharp
Estou com problema em abrir uma planilha q fica localizada dentro de um arquivo .Zip
private ExcelPackage package; public ExcelReader(string zipFile, string excelFile, string sheetName) { _zipFile = zipFile; _excelFile = excelFile; _sheetName = sheetName; } public bool open() { FileInfo file = new FileInfo(_zipFile); if (!file.Exists) { return true; } var archive = ZipFile.OpenRead(@"./1.zip"); string p = (DIR_PLANILHA + _excelFile).ToLower(); ZipArchiveEntry entry = null; foreach (var ze in archive.Entries) { if (ze.FullName.EndsWith(p, StringComparison.OrdinalIgnoreCase)) { entry = ze; break; } } if (entry == null) { archive.Dispose(); return true; } try { package = new ExcelPackage(entry.Open()); } catch (NotSupportedException e) { Console.WriteLine("ERROOOOOOOOO" + e); } sheet = package.Workbook.Worksheets[_sheetName]; archive.Dispose(); return false; }
Patrick Statzner
Curtidas 0