Add(Name: String, [Type: PrxSheetType = 1]): IPrxSheet;
Name. New sheet name.
Type. The type of added sheet, a table sheet is added by default.
The Add method adds a sheet into the regular report.
If the Type parameter is set to PrxSheetType.Table, the sheet returned by the Add 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.
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;
SheetTab: IPrxTable;
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;
// Add a table sheet
Sheet := Sheets.Add("Sheet" + (i).ToString, PrxSheetType.Table);
Debug.WriteLine("Added table sheet " + Sheet.Name + ";");
// Enter value to table sheet
SheetTab := Sheet As IPrxTable;
SheetTab.TabSheet.Cell(0, 0).Value := i;
// Save report
(Report As IMetabaseObject).Save;
End Sub UserProc;
After executing the example the table sheet is added to the report, the number of report sheets is displayed in the A0 cell of this sheet.
See also: