Adds the formula rule to the rule collection.
Parameters
- formula
- The condition formula.
- style
- The style that is applied to the cell when the condition is met.
- ranges
- The cell ranges where the rule is applied.
Return Value
Returns the new formula rule.
This example creates a formula rule.
GcSpreadSheet1.Sheets[0].Cells[0, 0].Value = 2;
GcSpreadSheet1.Sheets[0].Cells[0, 1].Value = 1;
GcSpreadSheet1.Sheets[0].Cells[0, 2].Value = 1;
GcSpreadSheet1.Sheets[0].Cells[1, 0].Value = 1;
var style2 = new GrapeCity.Windows.SpreadSheet.Data.StyleInfo();
style2.Background = new SolidColorBrush(Colors.Yellow);
GcSpreadSheet1.Sheets[0].ConditionalFormats.AddFormulaRule("=A1=B1+C1", style2, new GrapeCity.Windows.SpreadSheet.Data.CellRange[] { new GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 5, 1) });
GcSpreadSheet1.Sheets(0).Cells(0, 0).Value = 2
GcSpreadSheet1.Sheets(0).Cells(0, 1).Value = 1
GcSpreadSheet1.Sheets(0).Cells(0, 2).Value = 1
GcSpreadSheet1.Sheets(0).Cells(1, 0).Value = 1
Dim style2 As New GrapeCity.Windows.SpreadSheet.Data.StyleInfo()
style2.Background = New SolidColorBrush(Colors.Yellow)
GcSpreadSheet1.Sheets(0).ConditionalFormats.AddFormulaRule("=A1=B1+C1", style2, New GrapeCity.Windows.SpreadSheet.Data.CellRange() { New GrapeCity.Windows.SpreadSheet.Data.CellRange(0, 0, 5, 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)