IPrxSheets.InsertAfter

Syntax

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

Parameters

Index. Index of the sheet, after which a new sheet must be inserted.

Name. New sheet name.

Type. The type of added sheet, a table sheet is added by default.

Description

The InsertAfter method inserts a new sheet after the sheet with the Index index.

Comments

If the Type parameter is set to PrxSheetType.Table, the sheet returned by the InsertAfter method can be cast to the IPrxTable interface; if the parameter is set to PrxSheetType.JsPlugin, the sheet can 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.InsertAfter(0"Sheet" + (i + 1).ToString, PrxSheetType.Table);
    Debug.WriteLine("Insert 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 after the first sheet, the console window will display information about sheet insertion.

See also:

IPrxSheets | IPrxTable | IPrxJsPlugin