Spread WinRT Documentation > Developer's Guide > Managing the User Interface > Using Formulas > Creating Custom Names |
Custom, user-defined names are identifiers that represent information in the sheet. A custom name can refer to a range of cells or a formula. You can define a custom name and then use the name in formulas. When the formula is evaluated, the custom name's value is referenced and evaluated. Use the SetCustomName method to create a custom name.
This example creates a custom name.
CS |
Copy Code |
---|---|
gcSpreadSheet1.Sheets[0].SetValue(0, 0, 1); gcSpreadSheet1.Sheets[0].SetValue(0, 1, 2); gcSpreadSheet1.Sheets[0].SetValue(0, 2, 3); gcSpreadSheet1.Sheets[0].SetCustomName("customName1", 0, 0, new GrapeCity.CalcEngine.Expressions.CalcDoubleExpression(12)); gcSpreadSheet1.Sheets[0].SetCustomName("customName2", 0, 0, "Average(20,45)"); gcSpreadSheet1.Sheets[0].SetCustomName("customName3", 0, 0, 1, 3); gcSpreadSheet1.Sheets[0].SetFormula(1, 0, "customName1"); gcSpreadSheet1.Sheets[0].SetFormula(1, 1, "customName2"); gcSpreadSheet1.Sheets[0].SetFormula(1, 2, "sum(customName3)"); |
VB |
Copy Code |
---|---|
gcSpreadSheet1.Sheets(0).SetValue(0, 0, 1) gcSpreadSheet1.Sheets(0).SetValue(0, 1, 2) gcSpreadSheet1.Sheets(0).SetValue(0, 2, 3) gcSpreadSheet1.Sheets(0).SetCustomName("customName1", 0, 0, New GrapeCity.CalcEngine.Expressions.CalcDoubleExpression(12)) gcSpreadSheet1.Sheets(0).SetCustomName("customName2", 0, 0, "Average(20,45)") gcSpreadSheet1.Sheets(0).SetCustomName("customName3", 0, 0, 1, 3) gcSpreadSheet1.Sheets(0).SetFormula(1, 0, "customName1") gcSpreadSheet1.Sheets(0).SetFormula(1, 1, "customName2") gcSpreadSheet1.Sheets(0).SetFormula(1, 2, "sum(customName3)") |