InsertAfter(Index: Integer; Name: String; [Type: PrxSheetType = 1]): IPrxSheet;
Insert(Index: integer; Name: string; Type: Prognoz.Platform.Interop.Report.PrxSheetType): Prognoz.Platform.Interop.Report.IPrxSheet;
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.
The InsertAfter method inserts a new sheet after the sheet with the Index index.
If the Type parameter value is PrxSheetType.Table, the sheet returned by the InsertAfter method can be lead to the IPrxTable interface, if value is PrxSheetType.Document - to the IPrxDocument interface.
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.InsertAfter(0, "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.InsertAfter(0, "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 after the first sheet, the console window will display information about sheet insertion.
See also: