Spread ASP.NET 15
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / UnaryComparisonConditionalFormattingRule Class / Formula Property
Example


In This Topic
    Formula Property (UnaryComparisonConditionalFormattingRule)
    In This Topic
    Gets or sets the formula.
    Syntax
    'Declaration
     
    Public Property Formula As String
    'Usage
     
    Dim instance As UnaryComparisonConditionalFormattingRule
    Dim value As String
     
    instance.Formula = value
     
    value = instance.Formula
    public string Formula {get; set;}

    Property Value

    The formula.
    Example
    This example uses a formula to evaluate the value in the rule.
    protected void Page_Load(object sender, EventArgs e)
    {
        if (this.IsPostBack) return;
        FpSpread1.Sheets[0].Cells[0, 0].Value = 3;
        FpSpread1.Sheets[0].Cells[1, 0].Value = 2;
        FpSpread1.Sheets[0].Cells[1, 1].Value = 4;
        FpSpread1.Sheets[0].Cells[0, 1].Value = 1;   
        //Unary comparison CF
        FarPoint.Web.Spread.UnaryComparisonConditionalFormattingRule unary = new FarPoint.Web.Spread.UnaryComparisonConditionalFormattingRule(FarPoint.Web.Spread.UnaryComparisonOperator.EqualTo, "=A1+B1", true);
        unary.Formula = "=A1+B1";
        unary.BackColor = System.Drawing.Color.Red;
        unary.FontStyle = new FarPoint.Web.Spread.SpreadFontStyle(FarPoint.Web.Spread.UnderlineFontStyle.None);
        unary.FontStyle.RegularBoldItalic = FarPoint.Web.Spread.RegularBoldItalicFontStyle.Bold;
        FpSpread1.ActiveSheetView.SetConditionalFormatting(1, 1, unary);      
    }
    Protected Sub Page_Load(sender As Object, e As EventArgs)
    If Me.IsPostBack Then
       Return
    End If
    FpSpread1.Sheets(0).Cells(0, 0).Value = 3
    FpSpread1.Sheets(0).Cells(1, 0).Value = 2
    FpSpread1.Sheets(0).Cells(1, 1).Value = 4
    FpSpread1.Sheets(0).Cells(0, 1).Value = 1
    'Unary comparison CF
    Dim unary As New FarPoint.Web.Spread.UnaryComparisonConditionalFormattingRule(FarPoint.Web.Spread.UnaryComparisonOperator.EqualTo, "=A1+B1", True)
    unary.Formula = "=A1+B1"
    unary.BackColor = System.Drawing.Color.Red
    unary.FontStyle = New FarPoint.Web.Spread.SpreadFontStyle(FarPoint.Web.Spread.UnderlineFontStyle.None)
    unary.FontStyle.RegularBoldItalic = FarPoint.Web.Spread.RegularBoldItalicFontStyle.Bold
    FpSpread1.ActiveSheetView.SetConditionalFormatting(1, 1, unary)
    End Sub
    See Also