See the example of creating and applying conditional formatting to data area.
Executing the example requires that the repository contains a regular report with the REPORT_INTRO identifier with data area on a sheet.
To execute the example, add links to the Metabase, Report, Tab, Drawing system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
DI: IPrxDataIsland;
Prop: IPrxDataIslandProperties;
TabFormat: ITabFormatCondition;
ValFormat: ITabFormatValues;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("REPORT_INTRO").Edit;
Report := MObj As IPrxReport;
DI := Report.DataIslands.Item(0).Edit;
Prop := DI.Properties;
TabFormat := Prop.FormatConditions.Add;
TabFormat.Type := TabConditionType.Values;
ValFormat := TabFormat.Details As ITabFormatValues;
// Three-colored gradient for cell formatting:
ValFormat.Style := TabFormatValuesStyle.ThreeColorScale;
// Set up minimum value:
ValFormat.MinValueType := TabFormatValueType.Lowest;
ValFormat.MinValueColor := GxColor.FromName("Yellow");
// Set up minimum value:
ValFormat.MidValueType := TabFormatValueType.Percent;
ValFormat.MidValue := 50;
ValFormat.MidValueColor := GxColor.FromName("Green");
// Set up maximum value:
ValFormat.MaxValueType := TabFormatValueType.Highest;
ValFormat.MaxValueColor := GxColor.FromName("Blue");
DI.Save;
MObj.Save;
End Sub UserProc;
After executing the example conditional formatting of the cells is determined on the basis of their values: style - three-color gradient. The created conditional formatting will be saved for the current report.
See also: