FormatConditionSetup Command

Purpose

Opens a standard dialog box that is used to set up parameters of the specified conditional format.

Parameters of Use

Command parameters are passed in the Data property. Executing the command requires to specify an array of the Variant type in this property, the elements of this array contain the following values:

Value type Description
Element 1:  ITabSheet The page containing a cell range.
Element 2: ITabRange The cell range, for which the dialog box for setting up conditional data formatting parameters opens. The parameter is used to create new conditional formats. A new conditional format is to be applied to the range specified in this parameter. If the existing conditional format is edited, it is not necessary to determine this parameter or specify the range, for which the conditional format was created.
Element 3: ITabFormatCondition The conditional format, which parameters are to be displayed in the dialog box.

Application Features

The command can be used only for regular reports.

Example

Executing the example requires a form with the Button1 button, the ReportBox component and the UiReport component named UiReport1 that is a data source for the ReportBox component.

Add links to the Forms, Report, Tab, and UI system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    Sheet: ITabSheet;
    Cond: ITabFormatCondition;
    Target: IUiCommandTarget;
    Context: IUiCommandExecutionContext;
    Data: Array;
Begin
    Sheet := (UiReport1.Instance As IPrxReport).ActiveSheet As ITabSheet;
    Cond := Sheet.FormatConditions.Add;
    Cond.Type := TabConditionType.Duplicate;
    Target := WinApplication.Instance.GetPluginTarget("Report");
    Context := Target.CreateExecutionContext;
    Data := New Variant[3];
    Data[0] := Sheet;
    Data[1] := Sheet.ParseRange("A0:C10");
    Data[2] := Cond;
    Context.Data := Data;
    Target.Execute("FormatConditionSetup", Context);
End Sub Button1OnClick;

Clicking the button creates a new conditional format for the current sheet of the regular report connected in the UiReport1 component. The conditional format will format cells with unique or duplicate values. The conditional format setup dialog box opens. After setting up conditional format parameters and clicking the OK button, this conditional format is applied to the A0:C10 range of the report sheet.

See also:

IUiCommandTarget.Execute