ILanerContext.CreateCopy

Syntax

CreateCopy(Laner: ILaner): IMetabaseObjectDescriptor;

Parameters

Laner. A workbook.

Description

The CreateCopy method creates a copy of the specified workbook.

Comments

A workbook can be used only in one context. To register a workbook in several contexts, use its copies.

During copying of a workbook within one context all formulas that use series from other workbooks are saved. During copying of a workbook between different contexts the formulas that contain dependences on other workbooks are lost.

Example

Executing the example requires a form with the following components: the Button component named Button1, the LanerBox component named LanerBox1, and the UiErAnalyzer component named UiErAnalyzer1. UiErAnalyzer1 is a data source for LanerBox1. A working area of the time series database should be loaded to UiErAnalyzer1.

There should also be the pContext variable that contains context.

The example is a handler of the OnClick event for the Button1 component.

Add links to the Express, ExtCtrls, Forms, Laner, Metabase and Tab system assemblies.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Var
    pContext: ILanerContext;
    Laner: ILaner;
    LanerObject: IMetabaseObjectDescriptor;
Begin
    pContext.BeginLoad;
    Laner := UiErAnalyzer1.ErAnalyzer.Laner;
    If Not Laner.IsInContext Then
        pContext.Register(Laner);
    Else
        LanerObject := pContext.CreateCopy(Laner);
        pContext.Register((LanerObject As IEaxAnalyzer).Laner);
        pContext.EndLoad;
    End If;
End Sub Button1OnClick;

After executing the example, a workbook is registered in a context. If it is already in the context, then its copy is registered.

See also:

ILanerContext