ITabFormatFormula.Condition

Syntax

Condition: String;

Description

The Condition property determines the formula that is used to select the cells to be formatted.

Comments

The result of formula calculation must be a logical value. The Value keyword must be used to create formulas, instead of which the value of a specific cell will be substituted during calculation; static methods can also be used.

Example

Executing the example requires a form with the Button1 button located on it, the TabSheetBox component named TabSheetBox1 and a data source for TabSheetBox.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);

Var

Tab: ITabSheet;

Range: ITabRange;

FormCond: ITabFormatCondition;

ValFormat: ITabFormatFormula;

Style: ITabCellStyle;

Begin

Style := New TabCellStyle.Create;

Style.Font.Color := GxColor.FromName("White");

Style.BackgroundColor := GxColor.FromName("Black");

Tab := TabSheetBox1.Source.GetTabSheet;

Range := Tab.View.Selection.Range;

FormCond := Range.FormatConditions.Add;

FormCond.Type := TabConditionType.Formula;

ValFormat := FormCond.Details As ITabFormatFormula;

ValFormat.Condition := "Value>Max(" + Range.Address + ")/10*4";

ValFormat.Style := Style;

End Sub Button1OnClick;

As a result, when the button is clicked, conditional format, applied to cells, satisfying the formula, will be added to the selected cell range. The cells, the values of which are greater than Max/10*4, will be displayed in white font on black background.

See also:

ITabFormatFormula