IStyledEntity.SaveStyleToContainer

Syntax

SaveStyleToContainer(Value: IStyleContainer);

Parameters

Value. The container, to which style is exported.

Description

The SaveStyleToContainer method exports style to the specified container.

Comments

To import style from the specified container, use the IStyledEntity.LoadStyleFromContainer method.

Example

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 should contain a map.

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

Sub UserProc;
Var
    mb: IMetabase;
    styleSheet: IStyleSheet;
    container : IStyleContainer;
    report: IEaxAnalyzer;
    entity: IStyledEntity;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get styles table
    styleSheet := mb.ItemById("STYLE_TB").Edit As IStyleSheet;
    // Get express report
    report := mb.ItemById("EAX_STYLE_MAP").Edit As IEaxAnalyzer;
    // Get map style
    entity := report.MapChart.MapChart As IStyledEntity;
    // Display style text tag in the console window
    Debug.WriteLine(entity.ContainerTag);
    // Set type of styles table in use
    entity.SheetType := StyleSheetType.InternalObject;
    // Add a styles container to styles table
    container := styleSheet.Add;
    // Specify container key
    entity.ContainerKey := container.Key;
    // Set style container name
    container.Name := "Style for express report map";
    // Unload map style to container
    entity.SaveStyleToContainer(container);
    // Save style view
    container.Preview.SaveToFile("C:\MapStylePreview.png");
    // Save styles table
    (styleSheet As IMetabaseObject).Save;
End Sub UserProc;

After executing the example the map style from the EAX_STYLE_MAP express report is exported to the STYLE_TB external styles table.

See also:

IStyledEntity