FarPoint.Web.Spread Assembly > FarPoint.Web.Spread.Model Namespace > DefaultSheetDataModel Class : SetFormula Method |
'Declaration Public Sub SetFormula( _ ByVal row As Integer, _ ByVal column As Integer, _ ByVal value As String _ )
'Usage Dim instance As DefaultSheetDataModel Dim row As Integer Dim column As Integer Dim value As String instance.SetFormula(row, column, value)
Exception | Description |
---|---|
ParseException | Specified value is not a valid formula |
For a list of the operators and functions you can use in formulas, refer to the Spread for .NET Formula Reference.
The Spread component can use absolute or relative cell references. You define the cell reference style for the spreadsheet The formula cannot contain both absolute and relative row or column references.
Private Sub Page_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load If(Me.IsPostBack)Then Return Dim dm As New FarPoint.Web.Spread.Model.DefaultSheetDataModel(8,8) FpSpread1.ActiveSheetView.DataModel=dm Dim i As Integer For i=0 To 3 FpSpread1.ActiveSheetView.SetValue(i,0,i) FpSpread1.ActiveSheetView.SetValue(i,1,i) FpSpread1.ActiveSheetView.SetValue(i,2,i) Next dm.SetFormula(5,0,"SUM(A3:A4)") dm.SetFormula(5,1,"SUM(B1:B2)") dm.SetFormula(5,2,"SUM(C1:C3)") ListBox1.Items.Add(dm.GetFormula(5,0).ToString()) ListBox1.Items.Add(dm.MaximumIterations.ToString()) ListBox1.Items.Add(dm.ReferenceStyle.ToString()) End Sub
private void Page_Load(object sender,System.EventArgs e) { if(this.IsPostBack)return; FarPoint.Web.Spread.Model.DefaultSheetDataModel dm=new FarPoint.Web.Spread.Model.DefaultSheetDataModel(10,10); FpSpread1.ActiveSheetView.DataModel=dm; int i; for(i=0;i<=3;i++) { FpSpread1.ActiveSheetView.SetValue(i,0,i); FpSpread1.ActiveSheetView.SetValue(i,1,i); FpSpread1.ActiveSheetView.SetValue(i,2,i); } dm.SetFormula(5,0,"SUM(A3:A4)"); dm.SetFormula(5,1,"SUM(B2:B4)"); dm.SetFormula(5,2,"SUM(C1:C3)"); ListBox1.Items.Add(dm.GetFormula(5,0).ToString()); ListBox1.Items.Add(dm.MaximumIterations.ToString()); ListBox1.Items.Add(dm.ReferenceStyle.ToString()); }
Target Platforms: Windows 7, Windows 8, Windows 10, Windows Vista, Windows Server 2003, Windows Server 2008, Windows Server 2012, Windows XP Professional