AD
Administrator
Syncfusion Team
March 20, 2006 09:19 AM UTC
Hi Alex,
Sorry for the delay in responding to you. Here is the code snippet, to retrieve the dependent Cells and dependent Formula Cells in the grid.
// To Retrieve all the cells affected
public void DisplayAllAffectedCells()
{
GridFormulaEngine engine = ((GridFormulaCellModel)this.gridControl1.CellModels["FormulaCell"]).Engine;
foreach(object o in engine.DependentCells.Keys)
// foreach(object o in engine.DependentFormulaCells.Keys)
{
string s1 = o as string;
Console.Write(s1 + " affects ");
Hashtable ht = (Hashtable) engine.DependentCells[s1];
// Hashtable ht = (Hashtable) engine.DependentFormulaCells[s1];
foreach(object o1 in ht.Keys)
{
string s2 = o1 as string;
Console.Write(s2 + " ");
}
Console.WriteLine("");
}
}
Please refer to the AdjustReferencesForRangeChange() and AdjustReferences() methods in the GridFormulaEngine.cs of the source code ( \Windows\Grid.Windows\Src\Extensions\Formulas\GridFormulaCell.cs ) to change the reference in the formula cell.
The DragEnter and DragDrop events will help you to get the initial and final position of the cell that is being dragged and dropped.
Get the cell that is being dragged ( DragEnter ) and retrieve the dependent formula cells ( above code snippet ) for the respective cell. Also change the references in the formula cells with respect to the newly dropped position of the cell in the grid by using the Drag Drop event.
Best regards,
Madhan.