Spread WinRT Documentation
GrapeCity.Xaml.SpreadSheet.Data Namespace / ConditionalFormat Class / AddSpecificTextRule Method
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.
Example


In This Topic
    AddSpecificTextRule Method
    In This Topic
    Adds the text rule to the rule collection.
    Syntax
    'Declaration
     
    Public Function AddSpecificTextRule( _
       ByVal comparisonOperator As TextComparisonOperator, _
       ByVal text As String, _
       ByVal style As StyleInfo, _
       ByVal ParamArray ranges() As CellRange _
    ) As SpecificTextRule
    'Usage
     
    Dim instance As ConditionalFormat
    Dim comparisonOperator As TextComparisonOperator
    Dim text As 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,
       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.Xaml.SpreadSheet.Data.StyleInfo();
    style.Background = new SolidColorBrush(Windows.UI.Colors.Blue);
    style.BorderLeft = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
    style.BorderTop = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
    style.BorderRight = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
    style.BorderBottom = new GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red);
    var style1 = new GrapeCity.Xaml.SpreadSheet.Data.StyleInfo();
    style1.Background = new SolidColorBrush(Windows.UI.Colors.Green);
    var style2 = new GrapeCity.Xaml.SpreadSheet.Data.StyleInfo();
    style2.Background = new SolidColorBrush(Windows.UI.Colors.Yellow);
    
    GcSpreadSheet1.Sheets[0].ConditionalFormats.AddSpecificTextRule(GrapeCity.Xaml.SpreadSheet.Data.TextComparisonOperator.Contains, "test", style, new GrapeCity.Xaml.SpreadSheet.Data.CellRange[] { new GrapeCity.Xaml.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.Xaml.SpreadSheet.Data.StyleInfo()
    style.Background = New SolidColorBrush(Windows.UI.Colors.Blue)
    style.BorderLeft = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
    style.BorderTop = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
    style.BorderRight = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
    style.BorderBottom = New GrapeCity.Xaml.SpreadSheet.Data.BorderLine(Windows.UI.Colors.Red)
    Dim style1 As New GrapeCity.Xaml.SpreadSheet.Data.StyleInfo()
    style1.Background = New SolidColorBrush(Windows.UI.Colors.Green)
    Dim style2 As New GrapeCity.Xaml.SpreadSheet.Data.StyleInfo()
    style2.Background = New SolidColorBrush(Windows.UI.Colors.Yellow)
    
    GcSpreadSheet1.Sheets(0).ConditionalFormats.AddSpecificTextRule(GrapeCity.Xaml.SpreadSheet.Data.TextComparisonOperator.Contains, "test", style, New GrapeCity.Xaml.SpreadSheet.Data.CellRange() {New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 10, 1)})
    See Also