ElementStyle(Element: Variant): IEaxDataAreaCellStyle;
ElementStyle[Element: Object]: Prognoz.Platform.Interop.Express.IEaxDataAreaCellStyle;
Element. Calculated element identifier.
The ElementStyle property determines cell formatting style for alternative hierarchy element.
To get identifier of calculated element, use the IDimInstance.Id property.
Executing the example requires that the repository contains an express report with the EXPRESS_REPORT identifier. One of dimensions must contain at least one alternative hierarchy.
Add links to the Dimensions, Express, Metabase, Tab system assemblies.
Sub UserProc;
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Hier: IEaxDataAreaHierarchy;
DimSel: IDimSelection;
DimEl: String;
CellStyle: IEaxDataAreaCellStyle;
CellFont: ITabFont;
Begin
MB := MetabaseClass.Active;
Express := MB.ItemById("EXPRESS_REPORT").Edit As IEaxAnalyzer;
// Get alternative hierarchy and first element
Hier := Express.DataArea.Hierarchies.Item(0);
DimSel := Hier.Selection;
DimSel.SelectAll;
DimEl := DimSel.Dimension.Elements.Id(DimSel.Element(0));
// New style for element
CellStyle := New EaxDataAreaCellStyle.Create;
// Alignment in element header
CellStyle.Header.HorizontalAlignment := TabFormatAlignment.Center;
// Font in data area by element
CellFont := CellStyle.Data.Font;
CellFont.Name := "Arial";
CellFont.Italic := TriState.OnOption;
CellStyle.Data.Font := CellFont;
// Set new style for element
Hier.ElementStyle(DimEl) := CellStyle;
// Refresh and save changes
Express.RefreshAll;
(Express As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the formatting style is set for the first element of alternative hierarchy: element header text is aligned by center; italic font style is set for cells with data.
The requirements and result of the Fore.NET Example execution match with those in the Fore Example.
Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.Express;
Imports Prognoz.Platform.Interop.ForeSystem;
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Tab;
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
Express: IEaxAnalyzer;
Hier: IEaxDataAreaHierarchy;
DimSel: IDimSelection;
DimEl: String;
CellStyle: EaxDataAreaCellStyle = New EaxDataAreaCellStyleClass();
CellFont: ITabFont;
Begin
MB := Params.Metabase;
Express := MB.ItemById["EXPRESS_REPORT"].Edit() As IEaxAnalyzer;
// Get alternative hierarchy and first element
Hier := Express.DataArea.Hierarchies.Item[0];
DimSel := Hier.Selection;
DimSel.SelectAll();
DimEl := DimSel.Dimension.Elements.Id[DimSel.Element[0]];
// Alignment in element header
CellStyle.Header.HorizontalAlignment := TabFormatAlignment.tfaCenter;
// Font in data area by element
CellFont := CellStyle.Data.Font;
CellFont.Name := "Arial";
CellFont.Italic := TriState.tsOnOption;
CellStyle.Data.Font := CellFont;
// Set new style for element
Hier.ElementStyle[DimEl] := CellStyle;
// Refresh and save changes
Express.RefreshAll();
(Express As IMetabaseObject).Save();
End Sub;
See also: