Spread Silverlight Documentation
AddSpecificTextRule Method
Example 


The comparison operator.
The text for comparison.
The style that is set to the cell when the condition is met.
The cell ranges where the rule is applied.
Adds the text rule to the rule collection.
Syntax
'Declaration
 
Public Function AddSpecificTextRule( _
   ByVal comparisonOperator As TextComparisonOperator, _
   ByVal text As System.String, _
   ByVal style As StyleInfo, _
   ByVal ParamArray ranges() As CellRange _
) As SpecificTextRule
'Usage
 
Dim instance As ConditionalFormat
Dim comparisonOperator As TextComparisonOperator
Dim text As System.String
Dim style As StyleInfo
Dim ranges() As CellRange
Dim value As SpecificTextRule
 
value = instance.AddSpecificTextRule(comparisonOperator, text, style, ranges)
public SpecificTextRule AddSpecificTextRule( 
   TextComparisonOperator comparisonOperator,
   System.string text,
   StyleInfo style,
   params CellRange[] ranges
)

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.
Example
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)})
Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional, Windows XP Professional, Windows NT 4.0 Workstation, SP6, Windows NT 4.0 Server, SP6

See Also

Reference

ConditionalFormat Class
ConditionalFormat Members

 

 


Copyright © GrapeCity, inc. All rights reserved.