GrapeCity.Xaml.SpreadSheet.Data
AddRule(FormattingRuleBase) Method
Example 


The rule to add.
Adds the rule.
Syntax
'Declaration
 
Public Function AddRule( _
   ByVal rule As FormattingRuleBase _
) As FormattingRuleBase
'Usage
 
Dim instance As ConditionalFormat
Dim rule As FormattingRuleBase
Dim value As FormattingRuleBase
 
value = instance.AddRule(rule)
public FormattingRuleBase AddRule( 
   FormattingRuleBase rule
)

Parameters

rule
The rule to add.

Return Value

Returns the new conditional rule.
Remarks
This method will modify the priority of the new added rule. The new added rule always has the highest priority that is to say, its priority will be 1 and all other existing rules' proierity will be plus 1.
Example
This example creates a two color scale rule.
GcSpreadSheet1.Sheets[0].Cells[0, 0].Value = -1;
GcSpreadSheet1.Sheets[0].Cells[1, 0].Value = 49;
GcSpreadSheet1.Sheets[0].Cells[2, 0].Value = 101;
GrapeCity.Xaml.SpreadSheet.Data.TwoColorScaleRule rule = new GrapeCity.Xaml.SpreadSheet.Data.TwoColorScaleRule();
rule.MinimumColor = Windows.UI.Colors.Yellow;
rule.MinimumType = GrapeCity.Xaml.SpreadSheet.Data.ScaleValueType.Number;
rule.MinimumValue = 1;
rule.MaximumColor = Windows.UI.Colors.Red;
rule.MaximumType = GrapeCity.Xaml.SpreadSheet.Data.ScaleValueType.Number;
rule.MaximumValue = 100;
rule.Ranges = new GrapeCity.Xaml.SpreadSheet.Data.CellRange[] { new GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 20, 1) };
GcSpreadSheet1.Sheets[0].ConditionalFormats.AddRule(rule);
GcSpreadSheet1.Sheets(0).Cells(0, 0).Value = -1
GcSpreadSheet1.Sheets(0).Cells(1, 0).Value = 49
GcSpreadSheet1.Sheets(0).Cells(2, 0).Value = 101
Dim rule as new GrapeCity.Xaml.SpreadSheet.Data.TwoColorScaleRule()
rule.MinimumColor = Windows.UI.Colors.Yellow
rule.MinimumType = GrapeCity.Xaml.SpreadSheet.Data.ScaleValueType.Number
rule.MinimumValue = 1
rule.MaximumColor = Windows.UI.Colors.Red
rule.MaximumType = GrapeCity.Xaml.SpreadSheet.Data.ScaleValueType.Number
rule.MaximumValue = 100
rule.Ranges = New GrapeCity.Xaml.SpreadSheet.Data.CellRange() { New GrapeCity.Xaml.SpreadSheet.Data.CellRange(0, 0, 20, 1) }
GcSpreadSheet1.Sheets(0).ConditionalFormats.AddRule(rule)
Requirements

Target Platforms: Windows Server 2012, Windows RT

See Also

Reference

ConditionalFormat Class
ConditionalFormat Members

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options