SaveStyleToContainer(Value: IStyleContainer);
SaveStyleToContainer(Value: Prognoz.Platform.Interop.Drawing.IStyleContainer);
Value. The container, to which style is exported.
The SaveStyleToContainer method exports style to the specified container.
To import style from the specified container, use the IStyledEntity.LoadStyleFromContainer method.
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.
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;
container: IStyleContainer;
report: IEaxAnalyzer;
entity: IStyledEntity;
Begin
// Get current repository
mb := Params.Metabase;
// 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
System.Diagnostics.Debug.WriteLine(entity.ContainerTag);
// Set type of styles table in use
entity.SheetType := StyleSheetType.sstInternalObject;
// Add a styles container to styles table
container := styleSheet.Add(0, "");
// 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;
See also: