IPrxSheets.Insert

Syntax

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

Insert(Index: integer; Name: string; Type: Prognoz.Platform.Interop.Report.PrxSheetType): Prognoz.Platform.Interop.Report.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 value is PrxSheetType.Table, the sheet returned by the Insert method can be lead to the IPrxTable interface, if it is PrxSheetType.Document - to the IPrxDocument 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 current repository
    MB := MetabaseClass.Active;
    
// Get report
    Report := Mb.ItemById("REPORT").Edit As IPrxReport;
    
// Get report sheets
    Sheets := Report.Sheets;
    i := Sheets.Count;
    
// Insert text sheet
    Sheet := Sheets.Insert(1"Doc" + (i + 1).ToString, PrxSheetType.Document);
    Debug.WriteLine(
"Text sheet is inserted " + Sheet.Name + ";");
    
// Save report
    (Report As IMetabaseObject).Save;
End Sub UserProc;

Imports Prognoz.Platform.Interop.Report;

Public Shared Sub Main(Params: StartParams);
Var
    MB: IMetabase;
    Report: IPrxReport;
    Sheets: IPrxSheets;
    Sheet: IPrxSheet;
    i: integer;
Begin
    
// Get current repository
    MB := Params.Metabase;
    
// Get report
    Report := Mb.ItemById["REPORT"].Edit() As IPrxReport;
    
// Get report sheets
    Sheets := Report.Sheets;
    i := Sheets.Count;
    
// Insert text sheet
    Sheet := Sheets.Insert(1"Doc" + (i + 1).ToString(), PrxSheetType.pstDocument);
    System.Diagnostics.Debug.WriteLine(
"Text sheet is inserted " + Sheet.Name + ";");
    
// Save report
    (Report As IMetabaseObject).Save();
End Sub;

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

See also:

IPrxSheets | IPrxTable | IPrxDocument