var engine = ((GridFormulaCellModel)gridControl1.Model.CellModels["FormulaCell"]).Engine;
//To Pass the GridRange
GridRangeInfo range = GridRangeInfo.Cells(1, 1, 2, 2);
int topIndex = range.Top;
int rightIndex = range.Right;
//To get the alpha label for the cells
string startAlpha = GridRangeInfo.GetAlphaLabel(range.Left);
string endAlpha = GridRangeInfo.GetAlphaLabel(range.Right);
//To convert the GridRange into AlphaLabelRange
var namedRange = startAlpha + topIndex + ":" + endAlpha + rightIndex;
//To add the namedrange
engine.AddNamedRange("Test", namedRange);
|