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 this example requires a form containing:

There should also be the pContext variable that contains context.

Add a link to the Metabase system assembly. Example is a handler of the OnClick event for the button.

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