Style: IPrxDataElementStyle;
Style: Prognoz.Platform.Interop.Report.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.
The requirements and result of Fore.NET Example execution match with those in the Fore Example. Use Fore.NET analogs instead of Fore components.
Add links to the Dimensions, Drawing, Report, Tab system assemblies.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Private Sub button1_Click(sender: System.Object; e: System.EventArgs);
Var
DI: IPrxDataIsland;
Report: IPrxReport;
Top: IPrxDataIslandDimension;
DIProp: IPrxDataIslandProperties;
Level1, Level2, Level3: IPrxDataIslandLevel;
Style1, Style2, Style3: IPrxCellStyle;
DimModelTop: IDimensionModel;
Levels: IDimLevels;
ColorRed, ColorSilver, ColorYellow: GxColor;
Gxcolor: GxColorClassClass = New GxColorClassClass();
Begin
Report := uiReportNet1.ReportUi.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 As TabCellStyle);
// Set style of the second level
Style2 := Level2.Style.Header;
Style2.BackgroundColor := ColorSilver;
Style2.Text := "Silver";
Level2.Style.Data.Assign(Style2 As TabCellStyle);
// Set style of the third level
Style3 := Level3.Style.Header;
Style3.BackgroundColor := ColorYellow;
Style3.Text := "Yellow";
Level3.Style.Data.Assign(Style3 As TabCellStyle);
DI.Save();
DI.Recalc();
End Sub;
See also: