Style: IPrxDataElementStyle;
The Style property determines parameters of data area formatting.
To get the object containing the dimension elements name, use the IPrxDataIslandDimensionCommon.Naming property.
Executing the example requires a form that contains the Button component with the Button1 identifier and the UiReport component with the UiReport1 identifier.
The UiReport component should be set up to the regular report containing data area. Data area dimension in Heading should be built on dictionary having three levels.
Add links to the Dimensions, Drawing, Report system assemblies. Example is the OnClick event handler for the Button1 component.
Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
DI: IPrxDataIsland;
Report: IPrxReport;
Top: IPrxDataIslandDimension;
DIProp: IPrxDataIslandProperties;
Level1, Level2, Level3: IPrxDataIslandLevel;
Style1, Style2, Style3: IPrxCellStyle;
DimModelTop: IDimensionModel;
Levels: IDimLevels;
ColorRed, ColorSilver, ColorYellow: IGxColor;
Begin
Report := UiReport1.Instance As IPrxReport;
DI := Report.DataIslands.Item(0).Edit;
DIProp := DI.Properties;
DimModelTop := DI.Slice.TopHeader.Item(0).Dimension.Dimension;
Levels := DimModelTop.Levels;
Top := DIProp.Dimension(DimModelTop);
// Get levels
Level1 := Top.Level(Levels.Item(0));
Level2 := Top.Level(Levels.Item(1));
Level3 := Top.Level(Levels.Item(2));
// Set colors
ColorRed := Gxcolor.FromName("Red");
ColorSilver := Gxcolor.FromName("Silver");
ColorYellow := Gxcolor.FromName("Yellow");
// Set style of the first level
Style1 := Level1.Style.Header;
Style1.BackgroundColor := ColorRed;
Style1.Text := "Red";
Level1.Style.Data.Assign(Style1);
// Set style of the second level
Style2 := Level2.Style.Header;
Style2.BackgroundColor := ColorSilver;
Style2.Text := "Silver";
Level2.Style.Data.Assign(Style2);
// Set style of the third level
Style3 := Level3.Style.Header;
Style3.BackgroundColor := ColorYellow;
Style3.Text := "Yellow";
Level3.Style.Data.Assign(Style3);
DI.Save;
DI.Recalc;
End Sub Button1OnClick;
After executing the example individual formatting style is applied to the hierarchy levels.
See also: