Board index » delphi » Quickreport without Database

Quickreport without Database

Hi
(Newbie question:)
I want to use the Quickreport Components, but my data isnt in a database,
it's in a record (with several strings in it). I think I have to write my
own Component with the help of TDataSet but I dont know how to do this.
I would be glad about every help!
Thanks
LMarco
 

Re:Quickreport without Database


No, you don't need to write your own component, just use the OnNeedData
event of the TQuickReport component.

"LMarco" <M.Luebber...@d-velop.de> schreef in bericht
news:8aku4t$qa11@bornews.borland.com...

Quote
> Hi
> (Newbie question:)
> I want to use the Quickreport Components, but my data isnt in a database,
> it's in a record (with several strings in it). I think I have to write my
> own Component with the help of TDataSet but I dont know how to do this.
> I would be glad about every help!
> Thanks
> LMarco

Re:Quickreport without Database


Quote
LMarco wrote:

> I want to use the Quickreport Components, but my data isnt in a database,
> it's in a record (with several strings in it). I think I have to write my
> own Component with the help of TDataSet but I dont know how to do this.
> I would be glad about every help!

Perhaps just create a temp table and fill it up with desired data is a
lot easier.
Or manually create the quick report details in run time, as I haven't
actually tested the code, you may need to set the quickRep1's
printIfEmptry to true, or even add an empty detailBand for it to print:

procedure Prt(rawData : array of string);
var workBand : TQRChildBand;
    i : integer;
begin
     with QuickRep1.create(application) do begin
        try
           // Assuming QuickRep1 already have some basic layout
           // the detail data are printed below the pageHeaderBand
           pageHeaderBand.hasChild := true;
           workBand := pageHeaderBand.childBand;
           workBand.height := 0;

           for i := low(rawData) to high(rawData) do begin
              // Create a child band
              workBand.hasChild := true;
              workBand := workBand.childBand;
              // Add a QRLabel to the child band
              with TQRLabel(workBand.addPrintable(TQRLabel)) do begin
                 top := 0;
                 left := 5;
                 caption := rawData[i];
              end;
           end;

           preview;

        finally
           free;
           application.processMessages;
        end;
     end;
end;

Other Threads