ITabFormatScale.TargetType

Syntax

TargetType: TabFormatColorScaleTargetType;

Description

The TargetType property determines application area of the color scale.

Comments

To determine a numeric scale application area, use ITabFormatNumericScale.TargetType.

Example

Executing the example requires that the repository contains a regular report with the REG_SCALE identifier. For cells of the A0:K25 range any values must be set. In the example there is the DAdap class implementing data source for cell conditional format.

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

// Implement data source
Class DAdap: Object, ITabFormatDataAdapter
    Public Function get_Data(Row: integer; Column: integer): Variant;
    Begin
        Return Row * Column;
    End Function get_Data;
End Class DAdap;

Sub UserProc;
Var
    MB: IMetabase;
    RegRep: IPrxReport;
    Tab: IPrxTable;
    Sheet: ITabSheet;
    Range: ITabRange;
    FormCond: ITabFormatCondition;
    Scale: ITabFormatScale;
Begin
    // Get repository
    MB := MetabaseClass.Active;
    // Get regular report
    RegRep := MB.ItemById("REG_SCALE").Edit As IPrxReport;
    // Get active report sheet
    Tab := RegRep.ActiveSheet As IPrxTable;
    // Get report sheet table
    Sheet := Tab.TabSheet;
    // Get cell range
    Range := Sheet.ParseRange("A0:K25");
    // Add new conditional format in collection
    FormCond := Range.FormatConditions.Add;
    // Add data source
    FormCond.DataAdapter := New DAdap.Create;
    // Set type of conditional format - numeric scale
    FormCond.Type := TabConditionType.Scale;
    // Get specific settings of conditional format
    Scale := FormCond.Details As ITabFormatScale;
    // Use automatic values
    Scale.UseAutoValues := True;
    // Start color
    Scale.StartColor := GxColor.FromName("Blue");
    // End color
    Scale.EndColor := GxColor.FromName("Green");
    // Use color scale for cell background filling
    Scale.TargetType := TabFormatColorScaleTargetType.BkColor;
    // Save changes
    (Regrep As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, cell background color for the A0:K25 range changes according to specified parameters.

See also:

ITabFormatScale