GrapeCity SPREAD for Windows Forms 12.0J
CellExpression コンストラクタ(Int32,Int32,Boolean,Boolean)


セルの行座標
セルの列座標
行座標が相対的かどうか
列座標が相対的かどうか
セル参照を使用して新しい式を作成します。
構文
'Declaration
 
Public Function New( _
   ByVal row As Integer, _
   ByVal column As Integer, _
   ByVal rowRelative As Boolean, _
   ByVal columnRelative As Boolean _
)
'使用法
 
Dim row As Integer
Dim column As Integer
Dim rowRelative As Boolean
Dim columnRelative As Boolean
 
Dim instance As New CellExpression(row, column, rowRelative, columnRelative)
public CellExpression( 
   int row,
   int column,
   bool rowRelative,
   bool columnRelative
)

パラメータ

row
セルの行座標
column
セルの列座標
rowRelative
行座標が相対的かどうか
columnRelative
列座標が相対的かどうか
次のサンプルコードは、式のプロパティの一部を返します。
//Spread for Windows Forms
fpSpread1.ActiveSheet.AutoCalculation = false; 
fpSpread1.ActiveSheet.SetValue(1, 2, System.Convert.ToDouble("0.00")); 
fpSpread1.ActiveSheet.AddCustomName("Alpha", new FarPoint.CalcEngine.CellExpression(1, 2, false)); 
fpSpread1.ActiveSheet.SetFormula(2, 2, "IF(Alpha>0, 0.5, 0)"); 
fpSpread1.ActiveSheet.SetText(4, 2, "0.00"); 
fpSpread1.ActiveSheet.AddCustomName("Omega", new FarPoint.CalcEngine.CellExpression(2, 2, false, false)); 
fpSpread1.ActiveSheet.SetFormula(5, 2, "IF(Omega>0, 0.5, 0)"); 
fpSpread1.ActiveSheet.AutoCalculation = true; 
fpSpread1.ActiveSheet.RecalculateAll(); 
FarPoint.CalcEngine.Expression expr = fpSpread1.ActiveSheet.GetCustomName("Alpha"); 
if (expr is FarPoint.CalcEngine.CellExpression) 
{ 
FarPoint.CalcEngine.CellExpression cellExpr = ((FarPoint.CalcEngine.CellExpression)(expr)); 
MessageBox.Show("The expression is in column " + cellExpr.Column.ToString()); 
}
//Spread for Web Forms
FpSpread1.Sheets[0].AutoCalculation = false; 
FpSpread1.Sheets[0].SetValue(1, 2, System.Convert.ToDouble("0.00")); 
FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel = new FarPoint.Web.Spread.Model.DefaultSheetDataModel();  
dataModel = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel; 
dataModel.AddCustomName("Alpha", new FarPoint.CalcEngine.CellExpression(1, 2, false, false)); 
FpSpread1.Sheets[0].SetFormula(2, 2, "IF(Alpha>0, 0.5, 0)"); 
FpSpread1.Sheets[0].SetText(4, 2, "0.00"); 
FarPoint.Web.Spread.Model.DefaultSheetDataModel dataModel1 = new FarPoint.Web.Spread.Model.DefaultSheetDataModel();  
dataModel1 = (FarPoint.Web.Spread.Model.DefaultSheetDataModel)FpSpread1.ActiveSheetView.DataModel;
dataModel1.AddCustomName("Omega", new FarPoint.CalcEngine.CellExpression(2, 2, false, false)); 
FpSpread1.Sheets[0].SetFormula(5, 2, "IF(Omega>0, 0.5, 0)"); 
FpSpread1.Sheets[0].AutoCalculation = true; 
FpSpread1.Sheets[0].RecalculateAll(); 
FarPoint.CalcEngine.Expression expr = dataModel.GetCustomName("Alpha"); 
if (expr is FarPoint.CalcEngine.CellExpression) 
{ 
FarPoint.CalcEngine.CellExpression cellExpr = ((FarPoint.CalcEngine.CellExpression)(expr)); 
TextBox1.Text = "The expression is in column " + cellExpr.Column.ToString(); 
}
'Spread for Windows Forms
FpSpread1.ActiveSheet.AutoCalculation = False
FpSpread1.ActiveSheet.SetValue(1, 2, CDbl("0.00"))
FpSpread1.ActiveSheet.AddCustomName("Alpha", New FarPoint.CalcEngine.CellExpression(1, 2, False, False))
FpSpread1.ActiveSheet.SetFormula(2, 2, "IF(Alpha>0, 0.5, 0)")
FpSpread1.ActiveSheet.SetText(4, 2, "0.00")
FpSpread1.ActiveSheet.AddCustomName("Omega", New FarPoint.CalcEngine.CellExpression(2, 2, False, False))
FpSpread1.ActiveSheet.SetFormula(5, 2, "IF(Omega>0, 0.5, 0)")
FpSpread1.ActiveSheet.AutoCalculation = True
FpSpread1.ActiveSheet.RecalculateAll()
Dim expr As FarPoint.CalcEngine.Expression = FpSpread1.ActiveSheet.GetCustomName("Alpha")
If TypeOf expr Is FarPoint.CalcEngine.CellExpression Then
Dim cellExpr As FarPoint.CalcEngine.CellExpression = CType(expr, FarPoint.CalcEngine.CellExpression)
MessageBox("The expression is in column " & cellExpr.Column.ToString)
'Spread for Web Forms
FpSpread1.Sheets(0).Rows.Count = 5
FpSpread1.Sheets(0).Columns.Count = 5
FpSpread1.Sheets(0).AutoCalculation = False
FpSpread1.Sheets(0).SetValue(1, 2, CDbl("0.00"))
Dim dataModel As New FarPoint.Web.Spread.Model.DefaultSheetDataModel
dataModel = FpSpread1.ActiveSheetView.DataModel
dataModel.AddCustomName("Alpha", New FarPoint.CalcEngine.CellExpression(1, 2, False, False))
FpSpread1.Sheets(0).SetFormula(2, 2, "IF(Alpha>0, 0.5, 0)")
FpSpread1.Sheets(0).SetText(4, 2, "0.00")
Dim dataModel1 As New FarPoint.Web.Spread.Model.DefaultSheetDataModel
dataModel1 = FpSpread1.ActiveSheetView.DataModel
dataModel1.AddCustomName("Omega", New FarPoint.CalcEngine.CellExpression(2, 2, False, False))
FpSpread1.Sheets(0).SetFormula(5, 2, "IF(Omega>0, 0.5, 0)")
FpSpread1.Sheets(0).AutoCalculation = True
FpSpread1.Sheets(0).RecalculateAll()
Dim expr As FarPoint.CalcEngine.Expression = dataModel.GetCustomName("Alpha")
If TypeOf expr Is FarPoint.CalcEngine.CellExpression Then
Dim cellExpr As FarPoint.CalcEngine.CellExpression = CType(expr, FarPoint.CalcEngine.CellExpression)
TextBox1.Text = "The expression is in column " & cellExpr.Column.ToString()
End If
参照

CellExpression クラス
CellExpression メンバ
オーバーロード一覧

 

 


Copyright © 2004 GrapeCity inc.