ITabFormatCondition.AppliedRange

Syntax

AppliedRange: ITabRange;

Description

The AppliedRange property determines the cell range with applied conditional formatting.

Comments

To set up conditional formatting, use the ITabFormatCellContent interface.

To get the list of formatting conditionsthat are used for a cell or cell range, use ITabRange.AppliedFormatConditions.

Example

Executing the example requires a form with a set of components:

Add links to the Tab, Forms, and Drawing system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    TSheet: ITabSheet;
    Range: ITabRange;
    FormCond: ITabFormatCondition;
    ValFormat: ITabFormatCellContent;
    Style: ITabCellStyle;
    Format: ITabFormatConditions;
Begin
    
// Add values to the table
    TSheet:= UiTabSheet1.TabSheet;
    TSheet.Cell(
00).Value := 5;
    TSheet.Cell(
10).Value := 6;
    TSheet.Cell(
20).Value := 2;
    TSheet.Cell(
30).Value := 7;
    
// Select a column with added values
    TSheet.View.Selection.SelectColumns;
    
// Add a conditional formatting for selected values
    TSheet := TabSheetBox1.Source.GetTabSheet;
    Range := TSheet.View.Selection.Range;
    FormCond := Range.FormatConditions.Add;
    FormCond.Type := TabConditionType.CellContent;
    ValFormat := FormCond.Details 
As ITabFormatCellContent;
    
// Set the Cell Value Is Greater Than Five condition
    ValFormat.ContentType := TabFormatContentType.CellValue;
    ValFormat.ValueCondition := TabConditionCellContentValue.Above;
    ValFormat.CellValue := 
5;
    
// Create a style for cells where condition is applied
    Style := New TabCellStyle.Create;
    Style.BackgroundColor := GxColor.FromName(
"Yellow");
    ValFormat.Style := Style;
    
// Determine addresses of cells where condition is applied
    Format := Range.FormatConditions;
    FormCond := Format.Item(
0);
    Memo1.Text := FormCond.AppliedRange.Address;
End Sub Button1OnClick;

Clicking the button displays the conditional formatting for specified values in the table:

See also:

ITabFormatCondition