public static IEnumerable <MetaDataTable> Read(XlsxReader xlsx) { var workSheet = xlsx.GetWorksheetIfExists(SheetNaming.PivotSheets); if (workSheet != null) { foreach (var sheet in workSheet.Entities <MetaDataTable>()) { yield return(sheet); } } }
public Sheet(XlsxReader xlsx, string sheetName = null, bool hasHeader = true) { _xlsx = xlsx; _hasHeader = hasHeader; var name = sheetName ?? _xlsx.WorksheetNames.FirstOrDefault() ?? @"sheet1"; if (!_xlsx.SheetEntries.ContainsKey(name)) { throw new WorksheetDoesNotExistException(name); } var sheetEntry = _xlsx.SheetEntries[name]; _worksheet = _xlsx.Workbook.GetEntry($"xl/{GetTarget( sheetEntry.RId )}"); if (_worksheet == null) { throw new WorksheetDoesNotExistException(name); } }