preparereport and tab pages...
instead of using the built in report preview form, I have decided to place a Tfrxpreview component onto a tabpage. I have several buttons that allow the user to interact with the report. I am loading individual reports from files. If I load an individual file, and click on my preview button, the report is display correctly. as an example, one of my reports will load some resistance calculations and display the report correctly formatted. These reports could contain one or several pages. as an example the following code generates a report containing 7 pages.
procedure DisplayVesselResistanceCalculations;
WriteCalculationsToDB;
FApplicationPath := ExtractFilePath(paramStr(0));
FPath := FApplicationPath + 'Reports\rpt_ResistanceCalculations.fr3';
Marineprop_Report.LoadFromFile(FPath);
Marineprop_Report.ShowReport;
Marineprop_ReportPreview.SetFocus;
end;
When loading an individual report, the reports will always display correctly. The user also has the option to build a master report from all of the individual reports. for example, the code below should generate a single report built from all of the individual reports...
procedure DisplayFullReport;
Marineprop_Report.Preview := nil;
Marineprop_Report.Preview := Marineprop_ReportPreview;
Marineprop_Report.LoadFromFile(FPath + 'rpt_VesselProperties.fr3');
Marineprop_Report.PrepareReport;
Marineprop_Report.LoadFromFile(FPath + 'rpt_ResistanceCalculations.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.LoadFromFile(FPath + 'rpt_PropellerCalculations.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.LoadFromFile(FPath + 'rpt_Chart1.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.LoadFromFile(FPath + 'rpt_Chart2.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.ShowPreparedReport;
Marineprop_ReportPreview.SetFocus;
end;
when running the above code, the master report is not built behind the scene. Instead, you can clearly see all of the reports being built on the preview window, with each of the individual reports appearing and then disappearing. once finished, the only report displayed in the preview window is rpt_Chart2. if I copy my source code onto a form, and open the form, the master report, which results in 18 pages, is built behind the scene, and then displayed as it is suppose to when the preview form opens. Obviously, the TfrxPreview component is not happy about being placed onto a tab page.
so, How do I build the reports such that they are built behind the scene and then correctly displayed when I place a tFrxPreview component on a tabpage??
best regards,
Arthur
procedure DisplayVesselResistanceCalculations;
WriteCalculationsToDB;
FApplicationPath := ExtractFilePath(paramStr(0));
FPath := FApplicationPath + 'Reports\rpt_ResistanceCalculations.fr3';
Marineprop_Report.LoadFromFile(FPath);
Marineprop_Report.ShowReport;
Marineprop_ReportPreview.SetFocus;
end;
When loading an individual report, the reports will always display correctly. The user also has the option to build a master report from all of the individual reports. for example, the code below should generate a single report built from all of the individual reports...
procedure DisplayFullReport;
Marineprop_Report.Preview := nil;
Marineprop_Report.Preview := Marineprop_ReportPreview;
Marineprop_Report.LoadFromFile(FPath + 'rpt_VesselProperties.fr3');
Marineprop_Report.PrepareReport;
Marineprop_Report.LoadFromFile(FPath + 'rpt_ResistanceCalculations.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.LoadFromFile(FPath + 'rpt_PropellerCalculations.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.LoadFromFile(FPath + 'rpt_Chart1.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.LoadFromFile(FPath + 'rpt_Chart2.fr3');
Marineprop_Report.PrepareReport(False);
Marineprop_Report.ShowPreparedReport;
Marineprop_ReportPreview.SetFocus;
end;
when running the above code, the master report is not built behind the scene. Instead, you can clearly see all of the reports being built on the preview window, with each of the individual reports appearing and then disappearing. once finished, the only report displayed in the preview window is rpt_Chart2. if I copy my source code onto a form, and open the form, the master report, which results in 18 pages, is built behind the scene, and then displayed as it is suppose to when the preview form opens. Obviously, the TfrxPreview component is not happy about being placed onto a tab page.
so, How do I build the reports such that they are built behind the scene and then correctly displayed when I place a tFrxPreview component on a tabpage??
best regards,
Arthur