IPrxSheets.Insert

Syntax

Insert(Index: Integer, Name: String; [Type: PrxSheetType = 1]): IPrxSheet;

Parameters

Index. Sheet position index.

Name. New sheet name.

Type. Type of the added sheet. A table sheet is added by default.

Description

The Insert method inserts a new sheet into the position passed by the Index parameter.

Comments

If the Type parameter is set to PrxSheetType.Table, the sheet returned by the Insert method should be cast to the IPrxTable interface; if the parameter is set to PrxSheetType.JsPlugin, the sheet should be cast to the IPrxJsPlugin interface.

Example

Executing the example requires that the repository contains a regular report with the REPORT identifier.

Add links to the Metabase, Report system assemblies.

Sub UserProc;
Var
    MB: IMetabase;
    Report: IPrxReport;
    Sheets: IPrxSheets;
    Sheet: IPrxSheet;
    i: Integer;
Begin
    // Get the current repository
    MB := MetabaseClass.Active;
    // Get report
    Report := Mb.ItemById("REPORT").Edit As IPrxReport;
    // Get report sheets
    Sheets := Report.Sheets;
    i := Sheets.Count;
    // Insert sheet
    Sheet := Sheets.Insert(1"Sheet" + (i + 1).ToString, PrxSheetType.Table);
    Debug.WriteLine("Inserted sheet: " + Sheet.Name + ";");
    // Save report
    (Report As IMetabaseObject).Save;
End Sub UserProc;

After executing the example, the table sheet will be inserted to the report as the second sheet, the console window will display information about sheet insertion.

See also:

IPrxSheets | IPrxTable | IPrxJsPlugin