Spread Windows Forms 8.0 Product Documentation
ComparisonOperator Enumeration
Example Example 


Specifies the operator for conditional formats.
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
IsEmptyDetermines whether a cell is empty
IsFalseDetermines whether a formula evaluates to false
IsTrueDetermines whether a formula evaluates to true
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 changes the cell color based on different values that are entered.
FarPoint.Win.Spread.NamedStyle styleCold = new FarPoint.Win.Spread.NamedStyle();
FarPoint.Win.Spread.NamedStyle styleCool = new FarPoint.Win.Spread.NamedStyle();
FarPoint.Win.Spread.NamedStyle styleMild = new FarPoint.Win.Spread.NamedStyle();
FarPoint.Win.Spread.NamedStyle styleWarm = new FarPoint.Win.Spread.NamedStyle();
FarPoint.Win.Spread.NamedStyle styleHot = new FarPoint.Win.Spread.NamedStyle();
styleCold.BackColor = Color.Blue;
styleCold.ForeColor = Color.White;
styleCool.BackColor = Color.Cyan;
styleMild.BackColor = Color.Lime;
styleWarm.BackColor = Color.Yellow;
styleHot.BackColor = Color.Red;

if (fpSpread1.ActiveSheet.Models.Style is FarPoint.Win.Spread.IConditionalFormatSupport)
{
((FarPoint.Win.Spread.IConditionalFormatSupport)fpSpread1.ActiveSheet.Models.Style).SetConditionalFormat(1,1,styleCold, FarPoint.Win.Spread.ComparisonOperator.LessThanOrEqualTo,
"40");
 
((FarPoint.Win.Spread.IConditionalFormatSupport)fpSpread1.ActiveSheet.Models.Style).SetConditionalFormat(1,1,styleCool, FarPoint.Win.Spread.ComparisonOperator.Between,
"40","55");
 
((FarPoint.Win.Spread.IConditionalFormatSupport)fpSpread1.ActiveSheet.Models.Style).SetConditionalFormat(1,1,styleMild, FarPoint.Win.Spread.ComparisonOperator.Between,
"55","75");
 
((FarPoint.Win.Spread.IConditionalFormatSupport)fpSpread1.ActiveSheet.Models.Style).SetConditionalFormat(1,1,styleWarm, FarPoint.Win.Spread.ComparisonOperator.Between,
"75","85");
 
((FarPoint.Win.Spread.IConditionalFormatSupport)fpSpread1.ActiveSheet.Models.Style).SetConditionalFormat(1,1,styleHot, FarPoint.Win.Spread.ComparisonOperator.GreaterThan,
"85");
}
Dim styleCold As New FarPoint.Win.Spread.NamedStyle
Dim styleCool As New FarPoint.Win.Spread.NamedStyle
Dim styleMild As New FarPoint.Win.Spread.NamedStyle
Dim styleWarm As New FarPoint.Win.Spread.NamedStyle
Dim styleHot As New FarPoint.Win.Spread.NamedStyle
styleCold.BackColor = Color.Blue
styleCold.ForeColor = Color.White
styleCool.BackColor = Color.Cyan
styleMild.BackColor = Color.Lime
styleWarm.BackColor = Color.Yellow
styleHot.BackColor = Color.Red

FpSpread1.ActiveSheet.Cells(1, 1).Value = 73

If TypeOf FpSpread1.ActiveSheet.Models.Style Is FarPoint.Win.Spread.IConditionalFormatSupport Then

CType(FpSpread1.ActiveSheet.Models.Style, FarPoint.Win.Spread.IConditionalFormatSupport).SetConditionalFormat(1, 1, styleCold,
FarPoint.Win.Spread.ComparisonOperator.LessThanOrEqualTo, "40")

CType(FpSpread1.ActiveSheet.Models.Style, FarPoint.Win.Spread.IConditionalFormatSupport).SetConditionalFormat(1, 1, styleCool,
FarPoint.Win.Spread.ComparisonOperator.Between, "40", "55")

CType(FpSpread1.ActiveSheet.Models.Style, FarPoint.Win.Spread.IConditionalFormatSupport).SetConditionalFormat(1, 1, styleMild,
FarPoint.Win.Spread.ComparisonOperator.Between, "55", "75")

CType(FpSpread1.ActiveSheet.Models.Style, FarPoint.Win.Spread.IConditionalFormatSupport).SetConditionalFormat(1, 1, styleWarm,
FarPoint.Win.Spread.ComparisonOperator.Between, "75", "85")

CType(FpSpread1.ActiveSheet.Models.Style, FarPoint.Win.Spread.IConditionalFormatSupport).SetConditionalFormat(1, 1, styleHot,
FarPoint.Win.Spread.ComparisonOperator.GreaterThan, "85")

End If
Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         FarPoint.Win.Spread.ComparisonOperator

Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8

See Also

Reference

FarPoint.Win.Spread Namespace
ComparisonOperator Property (ConditionalFormat Class)

User-Task Documentation

Setting up Conditional Formatting of a Cell

 

 


Copyright © GrapeCity, inc. All rights reserved.