public static CellValue[] GetValList(Range cell, CellValue.CellValType type) { var tblRng = new TblRange(cell); int row = cell.Row; int wnd = ValListGenerator.Instance.Wnd; int from, to; if (ValListGenerator.Instance.AllRows) { from = tblRng.FirstRow; to = tblRng.LastRow; } else { from = row - wnd > tblRng.FirstRow ? row - wnd : tblRng.FirstRow; to = row + wnd < tblRng.LastRow ? row + wnd : tblRng.LastRow; } var ws = cell.Worksheet; Range col = ws.Range[ws.Cells[from, cell.Column], ws.Cells[to, cell.Column]]; var tmp = new List <ExCell>(); foreach (object r in col) { tmp.Add(new ExCell((Range)r, false)); } CellValue[] valList = tmp .Where(c => c.Value.Type == type && !string.IsNullOrEmpty(c.Value.ToString())) .Select(c => c.Value).Distinct().ToArray(); return(valList); }
public void Reload() { if (!IsWorkSheet) { return; } _selection = (Range)ThisWorkbook.app.Selection; _activeCell = ThisWorkbook.app.ActiveCell; _tblRange = new TblRange(_activeCell); _activeRow = new ActiveRow(ActiveCell); OnPropertyChanged(nameof(ExcelTools.ActiveRow)); OnPropertyChanged(nameof(CurRowNumInRng)); }