private void Form1_Load(object sender, System.EventArgs e)
{
fpSpread1.ActiveSheet.RowCount = 4;
fpSpread1.ActiveSheet.ColumnCount = 4;
fpSpread1.ActiveSheet.DefaultStyle.CellType = new FarPoint.Win.Spread.CellType.NumberCellType();
fpSpread1.ActiveSheet.HorizontalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
fpSpread1.ActiveSheet.VerticalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
fpSpread1.ActiveSheet.Cells[0, 0, 2, 2].BackColor = Color.LightPink;
fpSpread1.ActiveSheet.Cells[3, 3].BackColor = Color.LemonChiffon;
fpSpread1.ActiveSheet.Cells[3, 3].Border = new FarPoint.Win.LineBorder(Color.Blue, 2);
fpSpread1.ActiveSheet.SetValue(0, 0, 10);
fpSpread1.ActiveSheet.SetValue(1, 0, 20);
fpSpread1.ActiveSheet.SetValue(2, 0, 30);
fpSpread1.ActiveSheet.SetValue(0, 1, 40);
fpSpread1.ActiveSheet.SetValue(1, 1, 50);
fpSpread1.ActiveSheet.SetValue(2, 1, 60);
fpSpread1.ActiveSheet.SetValue(0, 2, 70);
fpSpread1.ActiveSheet.SetValue(1, 2, 80);
fpSpread1.ActiveSheet.SetValue(2, 2, 90);
FarPoint.Win.Spread.Model.ICustomFunctionSupport fs = (FarPoint.Win.Spread.Model.ICustomFunctionSupport)fpSpread1.ActiveSheet.Models.Data;
FarPoint.CalcEngine.FunctionInfo f = fs.GetCustomFunction("MySumFunction");
if (f == null)
{
//作成したカスタム関数を追加します
fs.AddCustomFunction(new MySumFunction());
}
else
{
fs.RemoveCustomFunction("MySumFunction");
}
//セルに関数を設定します
fpSpread1.ActiveSheet.SetFormula(3, 3, "MySumFunction(A1:C3)");
}
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
FpSpread1.ActiveSheet.RowCount = 4
FpSpread1.ActiveSheet.ColumnCount = 4
FpSpread1.ActiveSheet.DefaultStyle.CellType = New FarPoint.Win.Spread.CellType.NumberCellType
FpSpread1.ActiveSheet.HorizontalGridLine = New FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None)
FpSpread1.ActiveSheet.VerticalGridLine = New FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None)
FpSpread1.ActiveSheet.Cells(0, 0, 2, 2).BackColor = Color.LightPink
FpSpread1.ActiveSheet.Cells(3, 3).BackColor = Color.LemonChiffon
FpSpread1.ActiveSheet.Cells(3, 3).Border = New FarPoint.Win.LineBorder(Color.Blue, 2)
FpSpread1.ActiveSheet.SetValue(0, 0, 10)
FpSpread1.ActiveSheet.SetValue(1, 0, 20)
FpSpread1.ActiveSheet.SetValue(2, 0, 30)
FpSpread1.ActiveSheet.SetValue(0, 1, 40)
FpSpread1.ActiveSheet.SetValue(1, 1, 50)
FpSpread1.ActiveSheet.SetValue(2, 1, 60)
FpSpread1.ActiveSheet.SetValue(0, 2, 70)
FpSpread1.ActiveSheet.SetValue(1, 2, 80)
FpSpread1.ActiveSheet.SetValue(2, 2, 90)
Dim fs As FarPoint.Win.Spread.Model.ICustomFunctionSupport = FpSpread1.ActiveSheet.Models.Data
Dim f As FarPoint.CalcEngine.FunctionInfo = fs.GetCustomFunction("MySumFunction")
If f Is Nothing Then
'作成したカスタム関数を追加します
fs.AddCustomFunction(New MySumFunction)
Else
fs.RemoveCustomFunction("MySumFunction")
End If
'セルに関数を設定します
FpSpread1.ActiveSheet.SetFormula(3, 3, "MySumFunction(A1:C3)")
End Sub