Adds the text rule to the rule collection.
Parameters
- comparisonOperator
- The comparison operator.
- text
- The text for comparison.
- style
- The style that is set to the cell when the condition is met.
- ranges
- The cell ranges where the rule is applied.
Return Value
Returns the new text rule.
This example creates a specific text rule.
GcSpreadSheet1.Sheets[0].SetValue(0, 0, "testing");
GcSpreadSheet1.Sheets[0].SetValue(1, 0, "test");
GcSpreadSheet1.Sheets[0].SetValue(2, 0, "a");
GcSpreadSheet1.Sheets[0].SetValue(3, 0, "t");
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);
GcSpreadSheet1.Sheets[0].ConditionalFormats.AddSpecificTextRule(GrapeCity.Windows.SpreadSheet.Data.TextComparisonOperator.Contains, "test", style, new GrapeCity.Windows.SpreadSheet.Data.CellRange[] { new GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 10, 1) });
GcSpreadSheet1.Sheets(0).SetValue(0, 0, "testing")
GcSpreadSheet1.Sheets(0).SetValue(1, 0, "test")
GcSpreadSheet1.Sheets(0).SetValue(2, 0, "a")
GcSpreadSheet1.Sheets(0).SetValue(3, 0, "t")
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)
GcSpreadSheet1.Sheets(0).ConditionalFormats.AddSpecificTextRule(GrapeCity.Windows.SpreadSheet.Data.TextComparisonOperator.Contains, "test", style, New GrapeCity.Windows.SpreadSheet.Data.CellRange() {New GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 10, 1)})
Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional (SP4), Windows XP (SP2), Windows 2008, Windows 2003 Server (SP1)