ImportFromFile(FilePath: String): Boolean;
FilePath. Path and name of the file, from which data is imported.
The ImportFromFile method imports data and returns whether data is imported successfully.
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:
Regular report specified in the Report property should be opened for edit.
Sheet names in the regular report differ from sheet names in the file.
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: