public Cell GetDeclarationField(DeclarationField field) { Cell cell; if (MappedHeader != null && MappedHeader.TryGetValue(field, out cell)) { return(cell); } TColumnInfo colSpan; var exactCell = adapter.GetDeclarationFieldWeak(ColumnOrdering, row, field, out colSpan); if (exactCell.Text.Trim() != "" || exactCell.Col == -1) { return(exactCell); } for (int i = exactCell.Col + exactCell.MergedColsCount; i < colSpan.EndColumn;) { var mergedCell = adapter.GetCell(row, i); if (mergedCell == null) { break; } if (mergedCell.Text.Trim() != "") { return(mergedCell); } i += mergedCell.MergedColsCount; } return(exactCell); }
public Cell GetDeclarationField(DeclarationField field, bool except = true) { try { Cell cell; if (MappedHeader != null && MappedHeader.TryGetValue(field, out cell)) { return(cell); } TColumnInfo colSpan; var exactCell = adapter.GetDeclarationFieldWeak(ColumnOrdering, row, field, out colSpan); if (exactCell.Text.Trim() != "") { return(exactCell); } for (int i = colSpan.BeginColumn + exactCell.MergedColsCount; i < colSpan.EndColumn;) { var mergedCell = adapter.GetCell(row, i); if (mergedCell == null) { break; } if (mergedCell.Text.Trim() != "") { return(mergedCell); } i += mergedCell.MergedColsCount; } return(exactCell); } catch (SmartParserFieldNotFoundException e) { if (!except) { return(null); } throw e; } }