Setting Up Express Report and Page Parameters

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.

Example

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:

See also:

General Principles of Programming using the Report Assembly