Spread WPF 15
GrapeCity.Windows.SpreadSheet.Data Namespace / ComparisonOperator Enumeration
Example Example


In This Topic
    ComparisonOperator Enumeration
    In This Topic
    Specifies the conditional format operators.
    Syntax
    'Declaration
     
    Public Enum ComparisonOperator 
       Inherits System.Enum
    'Usage
     
    Dim instance As ComparisonOperator
    public enum ComparisonOperator : System.Enum 
    Members
    MemberDescription
    BetweenDetermines whether a cell value is between the two parameter values.
    EqualToDetermines whether a cell value is equal to the parameter value.
    GreaterThanDetermines whether a cell value is greater than the parameter value.
    GreaterThanOrEqualToDetermines whether a cell value is greater than or equal to the parameter value.
    LessThanDetermines whether a cell value is less than the parameter value.
    LessThanOrEqualToDetermines whether a cell value is less than or equal to the parameter value.
    NotBetweenDetermines whether a cell value is not between the two parameter values.
    NotEqualToDetermines whether a cell value is not equal to the parameter value.
    Example
    This example uses the ComparisonOperator enumeration.
    var style = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
    style.Background = new SolidColorBrush(Colors.Blue);
    style.BorderLeft = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
    style.BorderTop = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
    style.BorderRight = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
    style.BorderBottom = new GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red);
    var style1 = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
    style1.Background = new SolidColorBrush(Colors.Green);
    var style2 = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
    style2.Background = new SolidColorBrush(Colors.Yellow);
    
    var rule = GrapeCity.Windows.SpreadSheet.Data.CellValueRule.Create(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.Between, 2, 100, style);           
    rule.Ranges = new GrapeCity.Windows.SpreadSheet.Data.CellRange[] { new GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 5, 1) };
    gcSpreadSheet1.Sheets[0].ConditionalFormats.AddRule(rule);
    
    gcSpreadSheet1.Sheets[0].Cells[0, 0].Value = 1;
    gcSpreadSheet1.Sheets[0].Cells[1, 0].Value = 45;
    gcSpreadSheet1.Invalidate();
    Dim style As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
    style.Background = New SolidColorBrush(Colors.Blue)
    style.BorderLeft = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
    style.BorderTop = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
    style.BorderRight = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
    style.BorderBottom = New GrapeCity.Windows.SpreadSheet.Data.BorderLine(Colors.Red)
    Dim style1 As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
    style1.Background = New SolidColorBrush(Colors.Green)
    Dim style2 As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
    style2.Background = New SolidColorBrush(Colors.Yellow)
    
    Dim s As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
    Dim rule = GrapeCity.Windows.SpreadSheet.Data.CellValueRule.Create(GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator.Between, 2, 100, style)
    
    rule.Ranges = New GrapeCity.Windows.SpreadSheet.Data.CellRange() {New GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 5, 1)}
    GcSpreadSheet1.Sheets(0).ConditionalFormats.AddRule(rule)
    GcSpreadSheet1.Sheets(0).Cells(0, 0).Value = 1
    GcSpreadSheet1.Sheets(0).Cells(1, 0).Value = 45
    GcSpreadSheet1.Invalidate()
    GcSpreadSheet1.Invalidate()
    Inheritance Hierarchy

    System.Object
       System.ValueType
          System.Enum
             GrapeCity.Windows.SpreadSheet.Data.ComparisonOperator

    See Also