IStyleSheet.FindByTag

Syntax

FindByTag(Tag: String): IStyleContainerCollection;

Parameters

Tag. Text tag.

Description

The FindByTag method searches for the style container by the text tag.

Comments

The search is case-insensitive.

The text tag enables the user to determine which visualizer style is in the container:

Example

Consider the example of connecting a styles table to an express report.

Executing the example requires that the repository contains a styles table with the STYLE_TB identifier and an express report with the EAX_STYLE_MAP identifier. The report should contain a chart.

Add links to the Drawing, Express, Metabase system assemblies.

Sub UserProc;
Var
    mb: IMetabase;
    styleSheet: IStyleSheet;
    contCollection: IStyleContainerCollection;
    container: IStyleContainer;
    report: IEaxAnalyzer;
    entity: IStyledEntity;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get styles table
    styleSheet := mb.ItemById("STYLE_TB").Bind As IStyleSheet;
    // Search for containers that include chart styles
    contCollection := styleSheet.FindByTag("CHART");
    // If container is found, get the first container from all the found
    If contCollection.Count > 0 Then
        container := contCollection.Item(0);
        // Get express report
        report := mb.ItemById("EAX_STYLE_MAP").Edit As IEaxAnalyzer;
        // Get chart style
        entity := report.Chart.Chart As IStyledEntity;
        // Load chart style from style container
        entity.LoadStyleFromContainer(container);
        // Save report
        (report As IMetabaseObject).Save;
    End If;
End Sub UserProc;

After executing the example the styles used for chart are searched in the STYLE_TB styles table. If the styles are found, the first found style is applied to the chart in the EAX_STYLE_MAP express report.

Consider the example of applying a style from the styles table already connected the express report.

Executing the example requires that the repository contains an express report with the EAX_STYLE_MAP identifier with the styles table connected to it. The report should contain a chart.

Add links to the Drawing, Express, Metabase system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    MObj: IMetabaseObject;
    ContainerCollection: IStyleContainerCollection;
    StyleContainer: IStyleContainer;
    StyleSheet: IStyleSheet;
    StyledEntity: IStyledEntity;
    Report: IEaxAnalyzer;
Begin
    // Get the current repository
    MB := MetabaseClass.Active;
    // Open express report for edit
    MObj := MB.ItemById("EAX_STYLE_MAP").Edit;
    Report := MObj As IEaxAnalyzer;
    // Get styles table
    StyleSheet := Report.StyleSheet;
    // Search for containers containing styles for chart
    ContainerCollection := StyleSheet.FindByTag("CHART");
    // If containers are found, get the first container
    If ContainerCollection.Count > 0 Then
        StyleContainer := ContainerCollection.Item(0);
        // Get chart style
        StyledEntity := Report.Chart.Chart As IStyledEntity;
        // Connect style for chart from style container
        StyledEntity.LoadStyleFromContainer(StyleContainer);
        // Save report
        (Report As IMetabaseObject).Save;
    End If;
End Sub UserProc;

After executing the example the styles used for chart are searched in the EAX_STYLE_MAP express report. If the styles are found, the first found style is applied to the chart in the report.

See also:

IStyleSheet