Spread ASP.NET 6.0 Product Documentation
Formula Property
See Also  Example Send Feedback
FarPoint.Web.Spread Assembly > FarPoint.Web.Spread Namespace > Row Class : Formula Property


Glossary Item Box

Gets or sets the formula for cells in this row.

Syntax

Visual Basic (Declaration) 
Public Property Formula As String
Visual Basic (Usage)Copy Code
Dim instance As Row
Dim value As String
 
instance.Formula = value
 
value = instance.Formula
C# 
public string Formula {get; set;}

Property Value

String containing the formula for cells in this row

Remarks

Set this property to a mathematical expression made up of cell references, operators, and functions (either provided or custom functions you define). 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 by using the ReferenceStyle property. The formula cannot contain both absolute and relative row or column references.

Returning the value of the Formula property provides a string containing the written expression of the formula, for example, SUM(A1:B1). However, if you have changed the cell reference style to a style that cannot represent the formula, the control provides the formula with question marks as placeholders for cell references that cannot be represented.

For example, if you have defined relative cell references used in a formula in cell B1 as RC[-1]+R[-1]C, the formula is interpreted as add the value in the cell to the left (A1) to the value in the cell above ("B0"). The control treats the value in the cell "B0" as an empty cell. If you change the cell reference style to the A1 style, the formula becomes A1+B?, because the A1 style cannot represent cell "B0". However, the control still evaluates the formula as it would using the R1C1 reference style.

Example

This example creates a Row object for column 2. Values are then placed in cells A1 and A2, and the Formula property for the Cell object sums the values.
C#Copy Code
    FarPoint.Web.Spread.Row myrow;
    myrow = FpSpread1.ActiveSheetView.Rows[2]; 
    FpSpread1.ActiveSheetView.SetValue(0, 0, 10); 
    FpSpread1.ActiveSheetView.SetValue(1, 0, 10); 
    myrow.Formula = "SUM(A1:A2)";
Visual BasicCopy Code
    Dim myrow As FarPoint.Web.Spread.Row
    myrow = FpSpread1.ActiveSheetView.Rows(2)
    FpSpread1.ActiveSheetView.SetValue(0, 0, 10)
    FpSpread1.ActiveSheetView.SetValue(1, 0, 10)
    myrow.Formula = "SUM(A1:A2)"

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2002-2012 GrapeCity, Inc. All Rights Reserved.