IPrxReportImporter.ImportFromFile

Syntax

ImportFromFile(FilePath: String): Boolean;

Parameters

FilePath. Path and name of the file, from which data is imported.

Description

The ImportFromFile method imports data and returns whether data is imported successfully.

Comments

Data is imported by creating new sheets in a regular report, which correspond with the sheets from the Microsoft Excel file, and transferring data to them.

To import data successfully, meet the following requirements:

Example

Executing the example requires that the repository contains a regular report with the REPORT identifier. The file system should have the В D:\Work\data.xlsx Microsoft Excel file.

Add links to the Metabase, Report system assemblies.

Sub UserProc;
Var
    Mb: IMetabase;
    Report: IPrxReport;
    Import: IPrxReportImporter;
Begin
    Mb := MetabaseClass.Active;
    // Open report for edit
    Report := Mb.ItemById("REPORT").Edit As IPrxReport;
    // Create importer
    Import := New PrxReportImporter.Create;
    Import.Report := Report;
    // Data import
    Import.ImportFromFile("D:\Work\book1.xlsx");
    // Save changes
    Report.MetabaseObject.Save;
End Sub UserProc;

After executing the example the data is imported from the Microsoft Excel file to the regular report.

See also:

IPrxReportImporter