Spread WinRT Documentation
GrapeCity.Xaml.SpreadSheet.Data Namespace / FormattingRuleBase Class / Ranges Property
Example


In This Topic
    Ranges Property (FormattingRuleBase)
    In This Topic
    Gets the cell range collection for the rule.
    Syntax
    'Declaration
     
    Public Property Ranges As CellRange()
    'Usage
     
    Dim instance As FormattingRuleBase
    Dim value() As CellRange
     
    instance.Ranges = value
     
    value = instance.Ranges
    public CellRange[] Ranges {get; set;}

    Property Value

    The cell range collection. The value is never null.
    Example
    This example sets the Ranges property.
    gcSpreadSheet1.ActiveSheet.SetArray(0, 0, new object[,] { { 1 }, { 2 }, { 3 }, { 4 }, { 5 }, { 6 }, { 7 }, { 8 }, { 9 }, { 10 } });
    
    GrapeCity.Xaml.SpreadSheet.Data.CellValueRule cell = new GrapeCity.Xaml.SpreadSheet.Data.CellValueRule();
    cell.Operator = GrapeCity.Xaml.SpreadSheet.Data.ComparisonOperator.GreaterThan;
    cell.Value1 = 5;
    cell.Ranges = new GrapeCity.Xaml.SpreadSheet.Data.CellRange[] { new GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 10, 1) };
    cell.Style = new GrapeCity.Xaml.SpreadSheet.Data.StyleInfo() { Background = new SolidColorBrush(Windows.UI.Colors.Red) };
    this.gcSpreadSheet1.ActiveSheet.ConditionalFormats.AddRule(cell);
    
    GrapeCity.Xaml.SpreadSheet.Data.Top10Rule top = new GrapeCity.Xaml.SpreadSheet.Data.Top10Rule();
    top.Operator = GrapeCity.Xaml.SpreadSheet.Data.Top10ConditionType.Top;
    top.Rank = 3;
    top.StopIfTrue = true;
    top.Ranges = new GrapeCity.Xaml.SpreadSheet.Data.CellRange[] { new GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 10, 1) };
    top.Style = new GrapeCity.Xaml.SpreadSheet.Data.StyleInfo() { Foreground = new SolidColorBrush(Windows.UI.Colors.Cyan) };
    this.gcSpreadSheet1.ActiveSheet.ConditionalFormats.AddRule(top);
    GcSpreadSheet1.ActiveSheet.SetArray(0, 0, New Object(,) {{1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}})
    
    Dim cell As New GrapeCity.Xaml.SpreadSheet.Data.CellValueRule()
    cell.Operator = GrapeCity.Xaml.SpreadSheet.Data.ComparisonOperator.GreaterThan
    cell.Value1 = 5
    cell.Ranges = New GrapeCity.Xaml.SpreadSheet.Data.CellRange() {New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 10, 1)}
    cell.Style = New GrapeCity.Xaml.SpreadSheet.Data.StyleInfo() With {.Background = New SolidColorBrush(Windows.UI.Colors.Red)}
    GcSpreadSheet1.ActiveSheet.ConditionalFormats.AddRule(cell)
    
    Dim top As New GrapeCity.Xaml.SpreadSheet.Data.Top10Rule()
    top.Operator = GrapeCity.Xaml.SpreadSheet.Data.Top10ConditionType.Top
    top.Rank = 3
    top.StopIfTrue = True
    top.Ranges = New GrapeCity.Xaml.SpreadSheet.Data.CellRange() {New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 10, 1)}
    top.Style = New GrapeCity.Xaml.SpreadSheet.Data.StyleInfo() With {.Foreground = New SolidColorBrush(Windows.UI.Colors.Cyan)}
    GcSpreadSheet1.ActiveSheet.ConditionalFormats.AddRule(top)
    See Also