ElementStyle(Element: Variant): 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.
See also: