void GetColumns() { var columnNameCells = ColumnNamesRow().Cells(); foreach (var cell in columnNameCells) { var value = cell.ValueString(); if (value.Length == 0) { continue; } if (IgnoreColumnNames.Contains(value)) { continue; } if (VersionColumnName == value) { VersionColumnIndex = cell.Column(); } else { var columnIndex = cell.Column(); if (KeyColumnName == value) { IdColumnIndex = columnIndex; } Columns.Add(new SeedTableColumn(value, columnIndex)); } } CheckColumns(); if (Errors.Count == 0) { DefaultRowData = Columns.ToDictionary(column => column.Name, column => (object)null); } }
void GetColumns() { foreach (var columnIndex in Enumerable.Range(1, Worksheet.Dimension.Columns)) { var cell = Worksheet.Cells[ColumnNamesRowIndex, columnIndex]; var value = cell.GetValue <string>(); if (value == null || value.Length == 0) { continue; } if (IgnoreColumnNames.Contains(value)) { continue; } if (VersionColumnName == value) { VersionColumnIndex = columnIndex; } else { if (KeyColumnName == value) { IdColumnIndex = columnIndex; } Columns.Add(new SeedTableColumn(value, columnIndex)); } } CheckColumns(); }
void GetColumns() { foreach (var cell in Worksheet.Row(ColumnNamesRowIndex).Cells()) { var value = cell.GetValue <string>(); if (value == null || value.Length == 0) { continue; } if (IgnoreColumnNames.Contains(value)) { continue; } if (VersionColumnName == value) { VersionColumnIndex = cell.Address.ColumnNumber; } else { var columnIndex = cell.Address.ColumnNumber; if ("id" == value) { IdColumnIndex = columnIndex; } Columns.Add(new SeedTableColumn(value, columnIndex)); } } CheckColumns(); }