ElementStyle: IPrxDataElementStyle;
The ElementStyle property determines style for an element of arbitrary layout.
The following example assumes that there is the Report object with the IPrxReport type.
Sub UserProc;
Var
Report: IPrxReport;
DI: IPrxDataIsland;
Prop: IPrxDataIslandProperties;
Dim : IDimInstance;
DimProp : IPrxDataIslandDimension;
RN : IPrxDataIslandDimensionLayoutNodes;
n : IPrxDataIslandDimensionLayoutNode;
Cond : ITabFormatCondition;
ValFormat : ITabFormatValues;
Begin
DI := Report.DataIslands.Item(0).Edit;
Prop := DI.Properties;
Dim := DI.Slice.LeftHeader.Item(0).Dimension;
DimProp := Prop.Dimension(Dim.Dimension);
DimProp.CustomLayout := True;
DimProp.Layout.PreserveDimensionElementsOrder := True; // element order the same as in the dimension
RN := DimProp.Layout.RootNodes;
RN.Clear;
n := RN.Add;
n.DimElement(Dim) := 6;
n.Include := TriState.OnOption;
n.ElementStyle.Header.BackgroundColor := New GxColor.CreateRGB(50,60,210);
n.ElementStyle.Data.BackgroundColor := New GxColor.CreateRGB(150,160,210);
n := RN.Add;
n.DimElement(Dim) := 4;
n.Include := TriState.OnOption;
n.ElementStyle.Header.BackgroundColor := New GxColor.CreateRGB(200,100,100);
n.ElementStyle.Data.BackgroundColor := New GxColor.CreateRGB(220,150,150);
n := RN.Add;
n.DimElement(Dim) := 0;
n.Include := TriState.OnOption;
n.ElementStyle.Header.BackgroundColor := New GxColor.CreateRGB(0,100,100);
Cond := n.ElementStyle.FormatConditions.Add;
Cond.Type := TabConditionType.Values;
ValFormat := Cond.Details As ITabFormatValues;
//two-color gradient to set data cells' appearance
ValFormat.Style := TabFormatValuesStyle.TwoColorScale;
DI.Save;
End Sub UserProc;
After executing the example an arbitrary title consisting of three elements is created. The order of displaying elements in the data area corresponds to dimension hierarchy. Both data and heading appearance is set for elements of arbitrary layout. Conditional formatting is set for cells containing data of the last added element.
See also: