Zhuhm Source: Fastreport Chinese network browse:385 Date: 2012-07-10
In a program, no matter how large the program, as long as the print or preview is modal, you can share a tfrxreport variable and a few tfrxdbdataset. Just note that the steps to complete a reporting program are mainly the following:
1) Clear the report and get a new report content.
Frxreport1.clear.
2) Set the alias for the tfrxdbdataset you want to use, if you don't want to, omit this step, but generally it's best to use a different alias for the report.
Note This step is required before the report file is loaded because alias information is already included in the general design of the report file.
frxdbdataset1.username:= aliases;
3) Load the report or dynamically build a tfrxreportpage.
Frxreport1.loadfromfile (full file name of the report file);
4) Associate Tfrxdbdataset with Tdataset, and set which tfrxdbdataset to use.
frxreport1.datasets.clear;//clear the original data set first
frxdbdataset1.dataset:=dataset1;//the components of the associated Fastreport with the Tdataset dataset.
FRXREPORT1.DATASETS.ADD (FRXDBDATASET1);//load the associated Tfrxdbdataset into the report.
After these steps, you can use the Common report component as you would with a single tfrxreport.
How to share Tfrxreport and Tfrxdbdataset in Fastreport?