Consider the example of setting up page parameters and exporting report into *.xls format.
Executing the example requires that the repository contains a regular report with the REPORT_INTRO identifier.
To execute the example, add links to the Metabase and Report system assemblies.
Sub UserProc;
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Title: IPrxReportTitle;
Header : IPrxSheetHeaderBase;
HeaderPart : IPrxSheetHeaderPart;
Exp: IPrxReportExporter;
Begin
MB := MetabaseClass.Active;
MObj := MB.ItemById("REPORT_INTRO").Edit;
Report := MObj As IPrxReport;
// == Page parameters ==
// Report title
Title := Report.Title;
Title.Height := 20;
Header := Title As IPrxSheetHeaderBase;
HeaderPart := Header.Center;
HeaderPart.Text := "&[Name] &[Date]";
// Title is displayed on printing the report:
Header.Printable := True;
// == Report export ==
Exp := New PrxReportExporter.Create;
Exp.Report := Report;
Exp.Sheet := Report.Sheets.Item(0);
Exp.ExportObjects := False;
Exp.ExportToFile("C:\Report.xls","xls");
MObj.Save;
End Sub UserProc;
After executing the example the title of regular report will be set in the "Report name Date" format. The specified title will be displayed on report print and export. The settings will be saved for the report. Then the report can be printed with the specified parameters.
The report will be exported to a *.xls format with the specified parameters:
Only the first sheet of the report will be exported.
Objects located on report sheets will not be exported to the file.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Metabase;
Imports Prognoz.Platform.Interop.Report;
…
Public Shared Sub Main(Params: StartParams);
Var
MB: IMetabase;
MObj: IMetabaseObject;
Report: IPrxReport;
Title: IPrxReportTitle;
Header : IPrxSheetHeaderBase;
HeaderPart : IPrxSheetHeaderPart;
Exp: IPrxReportExporter;
Begin
MB := Params.Metabase;
MObj := MB.ItemById["REPORT_INTRO"].Edit();
Report := MObj As IPrxReport;
// == Page parameters ==
// Report title
Title := Report.Title;
Title.Height := 20;
Header := Title As IPrxSheetHeaderBase;
HeaderPart := Header.Center;
HeaderPart.Text := "&[Name] &[Date]";
// Title is displayed on printing the report:
Header.Printable := True;
// == Report export ==
Exp := New PrxReportExporter.Create();
Exp.Report := Report;
Exp.Sheet := Report.Sheets.Item[0];
Exp.ExportObjects := False;
Exp.ExportToFile("C:\Report.xls","xls");
MObj.Save();
End Sub;
See also: