Syncfusion.Calculate.Base
Example 


Syncfusion.Calculate Namespace > CalcEngine Class : RegisterGridAsSheet Method
The reference name used to refer to this ICalcData object from formulas in other ICalcData objects.
The ICalcData from the ICalcData object being registered.
An integer previously created with a call to CalcEngine.CreateSheetFamilyID. This number is used to identify the ICalcData objects as belonging to a particular family of ICalcData objects. You can only reference ICalcData objects from within the same family.

RegisterGridAsSheet Method (CalcEngine)

RegisterGridAsSheet is a method that registers an ICalcData object so it can be referenced in a formula from another ICalcData object.
Syntax
'Declaration
 
Public Sub RegisterGridAsSheet( _
   ByVal refName As String, _
   ByVal model As ICalcData, _
   ByVal sheetFamilyID As Integer _
) 
'Usage
 
Dim instance As CalcEngine
Dim refName As String
Dim model As ICalcData
Dim sheetFamilyID As Integer
 
instance.RegisterGridAsSheet(refName, model, sheetFamilyID)
public void RegisterGridAsSheet( 
   string refName,
   ICalcData model,
   int sheetFamilyID
)

Parameters

refName
The reference name used to refer to this ICalcData object from formulas in other ICalcData objects.
model
The ICalcData from the ICalcData object being registered.
sheetFamilyID
An integer previously created with a call to CalcEngine.CreateSheetFamilyID. This number is used to identify the ICalcData objects as belonging to a particular family of ICalcData objects. You can only reference ICalcData objects from within the same family.
Remarks
Essential Calculate supports multisheet references with its formulas. For example, if you have two ICalcData objects, then you can reference cells from the first ICalcData object in the second ICalcData object. For this to work, both ICalcData objects need to be registered using this method. The syntax for using a sheet reference as part of a formula is to prefix a cell reference with the sheet reference name followed by an exclamation point. The formula "= sheet1!A1 + sheet2!C3" would add the value is cell A1 for the ICalcData object whose reference name is sheet1 to the value from cell C3 in the ICalcData object whose reference name is sheet2.
Example
Use this code to use cross sheet references:
//Register three ICalcData objects so cell can be referenced across ICalcData objects:
int sheetfamilyID = CalcEngine.CreateSheetFamilyID();
myCalcEngine.RegisterGridAsSheet("summary", calcData1, sheetfamilyID);
myCalcEngine.RegisterGridAsSheet("income", calcData2, sheetfamilyID);
myCalcEngine.RegisterGridAsSheet("expenses", calcData3, sheetfamilyID);
....
//Sample formula usage for cells in calcData1, the 'summary' data source.
//This code sums ups some cells from calcData3, the 'expenses' data source
//and calcData2, the 'income' data source.
//Sum the range B2:B8 from expenses:
string sumExpenses = "= Sum(expenses!B2:expenses!B8)";
//Sum the range B2:B4 from income:
string sumIncome = "= Sum(income!B2:income!B4)";
'Register three ICalcData objects so cell can be referenced across ICalcData objects:
Dim sheetfamilyID As Integer = CalcEngine.CreateSheetFamilyID();
myCalcEngine.RegisterGridAsSheet("summary", calcData1, sheetfamilyID)
myCalcEngine.RegisterGridAsSheet("income", calcData2, sheetfamilyID)
myCalcEngine.RegisterGridAsSheet("expenses", calcData3, sheetfamilyID)
....
'Sample formula usage for cells in calcData1, the 'summary' data source.
'This code sums ups some cells from calcData3, the 'expenses' data source
'and calcData2, the 'income' data source.
'Sum the range B2:B8 from expenses:
Dim sumExpenses As String = "= Sum(expenses!B2:expenses!B8)"
'Sum the range B2:B4 from income:
Dim sumIncome As String = "= Sum(income!B2:income!B4)"
AssemblyVersion

Syncfusion.Calculate.Base: 17.4460.0.39

See Also