spreadsheet.ActiveSheet.CellValueChanged += ActiveSheet_CellValueChanged; void ActiveSheet_CellValueChanged(object sender, Syncfusion.XlsIO.Implementation.CellValueChangedEventArgs e) { //throw new NotImplementedException(); |
void ActiveSheet_CellValueChanged(object sender, Syncfusion.XlsIO.Implementation.CellValueChangedEventArgs e) { var grid = Spreadsheet.ActiveGrid; var family = FormulaEngine.GetSheetFamilyItem(grid); var cellref = family.GetTokenForGridModel(grid) + GridRangeInfo.GetAlphaLabel(grid.CurrentCell.ColumnIndex) + grid.CurrentCell.RowIndex; //To get the dependent cell if (grid.FormulaEngine.PrecedentCells.ContainsKey(cellref) && grid.FormulaEngine.PrecedentCells[cellref] != null) { Calculatedependentcell(cellref); var dependentcelllist = list; //Dependentcelllist } } public void Calculatedependentcell(string precedentCell) { var grid = Spreadsheet.ActiveGrid;
if (grid.FormulaEngine.PrecedentCells[precedentCell] == null) return;
var ht = (Hashtable)((Hashtable)grid.FormulaEngine.PrecedentCells[precedentCell]).Clone(); foreach (var o in ht.Keys) { var s1 = o as string;
var row = grid.FormulaEngine.RowIndex(s1); var col = grid.FormulaEngine.ColumnIndex(s1); var cell = GridRangeInfo.GetAlphaLabel(col) + row; if (s1 != null) { list.Add(s1); Calculatedependentcell(s1);//recursive call } } } |