FindByTag(Tag: String): IStyleContainerCollection;
FindByTag(Tag: string): Prognoz.Platform.Interop.Drawing.IStyleContainerCollection;
Tag. Text tag.
The FindByTag method searches for the style container by the text tag.
The search is case-insensitive.
The text tag enables the user to determine which visualizer style is in the container:
BubbleChart. Bubble chart style.
BubbleTree. Bubble tree style.
CHART. Chart style.
ExternLegend. External chart legend style.
MAP. Map style (topobase in the TBS format).
MapChart. Map style (topobase in the SVG format).
TAB. Table cell style.
TreeMap. Tree map style.
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. This report must 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 report.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Drawing;
Imports Prognoz.Platform.Interop.Express;
…
Public Shared Sub Main(Params: StartParams);
Var
mb: IMetabase;
styleSheet: IStyleSheet;
contCollection: IStyleContainerCollection;
container: IStyleContainer;
report: IEaxAnalyzer;
entity: IStyledEntity;
Begin
// Get current repository
mb := Params.Metabase;
// 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;
See also: