ITabFormatCondition.AppliedRange

Syntax

AppliedRange: ITabRange;

AppliedRange: Prognoz.Platform.Interop.Tab.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 for the Tab, Forms, Drawing, Forms.Net (for the Fore.NET example) 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;

Imports Prognoz.Platform.Forms.Net;
Imports Prognoz.Platform.Interop.Tab;
Imports Prognoz.Platform.Interop.Forms;
Imports Prognoz.Platform.Interop.Drawing;

Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
    TSheet: ITabSheet;
    Range: ITabRange;
    FormCond: ITabFormatCondition;
    ValFormat: ITabFormatCellContent;
    Style: ITabCellStyle;
    Format: ITabFormatConditions;
    GxColor: GxColorClass = 
New GxColorClassClass();
Begin
    
// Add values to the table
    TSheet:= uiTabSheetNet1.TabSheetUi.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 := tabSheetBoxNet1.Source.GetTabSheet();
    Range := TSheet.View.Selection.Range;
    FormCond := 
Range.FormatConditions.Add();
    FormCond.Type := TabConditionType.tctCellContent;
    ValFormat := FormCond.Details 
As ITabFormatCellContent;
    
// Set the Cell Value Is Greater Than Five condition
    ValFormat.ContentType := TabFormatContentType.tfctCellValue;
    ValFormat.ValueCondition := TabConditionCellContentValue.tccvAbove;
    ValFormat.CellValue := 
5;
    
// Create a style for cells where condition is applied
    Style := New TabCellStyle.Create();
    Style.BackgroundColor := GxColor.FromName(
"Yellow");
    ValFormat.Style := Style 
As TabCellStyle;
    
// Determine addresses of cells where condition is applied
    Format := Range.FormatConditions;
    FormCond := Format.Item[
0];
    listBox1.Items.Add(FormCond.AppliedRange.Address);
End Sub;

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

See also:

ITabFormatCondition