Table Export

To export the table, the ITabSheetExporter interface is used.

The example of export to the XLSX format of regular report sheet with the REPORT_TAB identifier is given. The report contains analytical data area.

As a result of example executing, the regular report sheet is exported in the Table.xlsx file. The file is placed in the root of the C disc.

Fore Example

To execute the example, add links to the Metabase, Report, Tab assemblies.

Sub Export;
Var
    mb: IMetabase;
    Report: IPrxReport;
    Table: ITabSheet;
    Exp: ITabSheetExporter;
Begin
    // Get current repository
    mb := MetabaseClass.Active;
    // Get regular report
    Report := mb.ItemById("REPORT_TAB").Bind As IPrxReport;
    // Get table
    Table := (Report.ActiveSheet As IPrxTable).TabSheet;
    // Create object for export
    Exp := New TabSheetExporter.Create;
    // Determine table being exported
    Exp.TabSheet := Table;
    // Determine that hidden rows and columns must be exported
    Exp.ExportHiddenCells := True;
    // Determine that formulas must be exported
    Exp.ExportFormulas := True;
    // Determine that objects are not exported
    Exp.ExportObjects := False;
    // Determine that sheet and cell protection parameters are exported
    Exp.SheetAccess := True;
    // Export
    Exp.ExportToFile("C:\Table.xlsx""XLSX");
End Sub Export;

Fore Example

Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;

Public Shared Sub Main(Params: StartParams);
Var
    mb: IMetabase;
    Report: IPrxReport;
    Table: TabSheet;
    Exp: ITabSheetExporter;
Begin
    // Get current repository
    mb := Params.Metabase;
    // Get regular report
    Report := mb.ItemById["REPORT_TAB"].Bind() As IPrxReport;
    // Get table
    Table := (Report.ActiveSheet As IPrxTable).TabSheet;
    // Create object for export
    Exp := New TabSheetExporter.Create();
    // Set exported table
    Exp.TabSheet := Table;
    // Determine that hidden rows and columns must be exported
    Exp.ExportHiddenCells := True;
    // Determine that formulas must be exported
    Exp.ExportFormulas := True;
    // Set that objects are not exported
    Exp.ExportObjects := False;
    // Determine that sheet and cell protection parameters are exported
    Exp.SheetAccess := True;
    // Export
    Exp.ExportToFile("C:\Table.xlsx""XLSX");
End Sub;

See also:

General Programming Principles Using the Tab Assembly