Using QRDesign
To use QRDesign in your application, only a few steps are required. Below we will show you one straight-forward way of doing so:
Let's assume that you already have some kind of data access form, for example:
Drop a TReportDesignerDialog component and two TButton components "Preview report" and "Edit report" on your form
Write the following code to the "Preview report" button's OnClick event:
procedure TForm2.Button1Click(Sender: TObject);
begin
ReportDesignerDialog1.DatabaseOwner:=Self;
ReportDesignerDialog1.PreviewReport('TEST.QR2');
end;
Write the following code to the "Print setup" button's OnClick event:
procedure TForm2.Button1Click(Sender:
TObject);
begin
ReportDesignerDialog1.DatabaseOwner:=Self;
ReportDesignerDialog1.EditReport('TEST.QR2');
end;
Now start your application and press the "Edit report" form. The report editor will show up, with an empty report layout because you haven't created a report yet.
Now select "File|New" to create a default report for your end user:
Select "List style" and press the "Next" button:
Leave the "database name" combobox empty and select your dataset from the table combobox:
Press "Next" and on the next page select the fields that you want to include in the report:
Press "Next" until the report wizard is on its last page. Select "Finish" to create your report:
You may of course continue now with editing, enhancing and fine-tuning your report layout, but for this example lets just save the report and close the report editor. Select "TEST" as the file name when saving.
Back on your data access form, you may now push the "Preview" button to print or preview your newly created report. When deploying your application, just make sure that you include the report file "TEST.QR2", and your end-user then can either just use the default report layout, or modify it to his own needs.