ITabRange.AppliedFormatConditions

Syntax

AppliedFormatConditions([AllCells: Boolean = false]): ITabFormatConditions;

AppliedFormatConditions[System.Boolean]: Prognoz.Platform.Interop.Tab.TabFormatConditions;

Parameters

AllCells. The parameter can be set to:

Description

The AppliedFormatConditions property returns a list of formatting conditions that are applied for a cell or cell range.

Comments

The following enumerations contains conditional formatting types: TabConditionType.

To determine a range cell for which conditional formatting is applied, use the ITabFormatCondition.AppliedRange property.

Example

To execute the example, make sure that the repository contains a regular report with the REGULAR_REPORT identifier. Add values and set up cell format in the report: add several formatting conditions for the selected cell range on the Conditional Formatting tab. Before example execution, select a range of cells containing values and save report.

Add links to the Metabase, Report, Tab system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    Table: ITabSheet;
    Range: ITabRange;
    Conditions: ITabFormatConditions;
    Cond: ITabFormatCondition;
Begin
    MB := MetabaseClass.Active;
    MObj := MB.ItemById(
"REGULAR_REPORT").Edit;
    Report := MObj 
As IPrxReport;
    Table := Report.ActiveSheet.Table;
    Range := Table.View.Selection.Range;
    Conditions := Range.AppliedFormatConditions(
True);
    
For Each Cond In Conditions Do
        Debug.WriteLine(
"Condition type: " + Cond.Type.ToString 
        + 
", is applied for the whole cell range " + Cond.AppliedRange.Address);
    
End For;
    Conditions := Range.AppliedFormatConditions(
False);
    
For Each Cond In Conditions Do
        Debug.WriteLine(
"Condition type: " + Cond.Type.ToString
        + 
", is applied for cells " + Cond.AppliedRange.Address);
    
End For;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    Report: IPrxReport;
    Table: ITabSheet;
    Range: ITabRange;
    Conditions: ITabFormatConditions;
    Cond: ITabFormatCondition;
Begin
    MB := Params.Metabase;
    MObj := MB.ItemById[
"REGULAR_REPORT"].Edit();
    Report := MObj 
As IPrxReport;
    Table := Report.ActiveSheet.Table;
    Range := Table.View.Selection.Range;
    Conditions := Range.AppliedFormatConditions[
True];
    
For Each Cond In Conditions Do
        System.Diagnostics.Debug.WriteLine(
"Condition type: " + Cond.Type.ToString()
        + 
", is applied for the whole cell range " + Cond.AppliedRange.Address);
    
End For;
    Conditions := Range.AppliedFormatConditions[
False];
    
For Each Cond In Conditions Do
        System.Diagnostics.Debug.WriteLine(
"Condition type: " + Cond.Type.ToString()
        + 
", is applied for cells " + Cond.AppliedRange.Address);
    
End For;
End Sub;

After executing the example, the console shows condition formatting types with a range of cells where they are applied.

See also:

ITabRange