Board index » delphi » How to create Report on run-time(Report Builder Pro)

How to create Report on run-time(Report Builder Pro)

We like to create a report based on the selected fields of the Dataset
dynamically.  In Quick Report, we did this by calling the following:
  QRCreateList(aReport, Form1, wwTable1, 'Report Name', FieldList);

How can we do this with ReportBuilder Pro?

Thanks in advance.

Hassan
has...@3log.com

 

Re:How to create Report on run-time(Report Builder Pro)


Quote
Hassan Farzadeh wrote:

> We like to create a report based on the selected fields of the Dataset
> dynamically.  In Quick Report, we did this by calling the following:
>   QRCreateList(aReport, Form1, wwTable1, 'Report Name', FieldList);

> How can we do this with ReportBuilder Pro?

> Thanks in advance.

> Hassan
> has...@3log.com

Below is some sample code from the Developers Guide section of the
ReportBuilder help file. You can also find an extensive example for
dynamic report creation in the source code to the ReportWizard which is
located in the EndUser.dpr demo project.

uses
  ppClass, ppBands, ppCtrls, ppTypes,

procedure TForm1.BuildReport;
var
  lHeaderBand: TppHeaderBand;
  lDetailBand: TppDetailBand;
  lFooterBand: TppFooterBand;
  lLabel: TppLabel;
  lDBText: TppDBText;

begin

  MyReport := TppReport.Create(Self);           {Self used here, refers to a
Delphi form}

  MyReport.DataPipeline := ppBDEPipeline1;

  {create header, detail, footer bands }
  lHeaderBand := TppHeaderBand.Create(Self);

  lHeaderBand.Report := MyReport;       {assign the band to the report}
  lHeaderBand.Height := 0.5;    {set the band height }

  lDetailBand := TppDetailBand.Create(Self);
  lDetailBand.Report := MyReport;
  lDetailBand.Height := 0.5;

  lFooterBand := TppFooterBand.Create(Self);
  lFooterBand.Report := MyReport;
  lFooterBand.Height := 0.5;

  {add a label component to the header band}
  lLabel := TppLabel.Create(Self);

  lLabel.Band := lHeaderband;   {assign the label to the band}

  lLabel.Font.Name := Times New Roman;
  lLabel.Size := 12;
  lLabel.Font.Style := [fsBold];
  lLabel.Caption := Company;
  lLabel.Top := 0.1;
  lLabel.Left := 0.1;

  {add a dbText component to the detail band}
  lDBText := TppDBText.Create(Self);

  lDBText.Band := aDetailBand;  {assign the dbtext to the band}

  lDBText.Font.Name := Times New Roman;
  lDBText.Size := 12;
  lDBText.AutoSize := True;
  lDBText.DataPipeline := ppBDEPipeline1;
  lDBText.DataField := 'Company';
  lDBText.Top := 0.1;
  lDBText.Left := 0.1;

end;

Cheers,

Nard

--
Nard Moseley            mailto:n...@digital-metaphors.com
Digital Metaphors       http://www.digital-metaphors.com

Other Threads