ITabFormatConditions.Add

Syntax

Add: ITabFormatCondition;

Description

The Add method adds a new conditional format and returns a reference to it.

Example

To execute the example a form with a button on it named Button1, the TabSheetBox component with the TabSheetBox1 name and a data source for TabSheetBox are required.

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

Var

Tab: ITabSheet;

Range: ITabRange;

FormCond: ITabFormatCondition;

ValFormat: ITabFormatCellContent;

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.CellContent;

ValFormat := FormCond.Details As ITabFormatCellContent;

ValFormat.ContentType := TabFormatContentType.CellValue;

ValFormat.ValueCondition := TabConditionCellContentValue.Above;

ValFormat.CellValue := 50;

ValFormat.Style := Style;

End Sub Button1OnClick;

As a result, when the button is clicked, for the selected cell range a conditional format will e added, which applies to cells with certain values. Cell values greater than "50" will be displayed in the white font on the black background.

See also:

ITabFormatConditions