0
votes

I'm using C++ Builder XE7 & FastReport components. My form contains two reports (TfrxReport components) and two export components (TfrxRTFExport, TfrxPDFExport). If I preview any of those two reports I have the option to export to RTF and PDF. But, I would like to disable RTF export for the second report while still having that option for the first report. How to do it? Thanks.

1
If you don't find a better solution, then you can always use two different units. Place a TfrxReport, TfrxRTFExport and TfrxPDFExport on a first DataModule, and a TfrxReport and TfrxPDFReport on the second DataModule. Now when you want to have both options you call it on the first DataModule, and when you only want PDFs you call it on the second DataModule.Marc Guillot
That's what I am doing at the moment, but still, I would like to have everything in one DataModule.Tracer
It's easy , just create your TfrxRTFExport before preview the first one , and , free before preview the second report. In Preview and ClosePreview events.Ilyes
Great! I didn't try that solution since I didn't believe it work if the component is not created in design-time. Thanks!Tracer

1 Answers

1
votes

Try this solution :

  • Remove the TfrxRTFExport component from your DataModule.

  • Declare your TfrxRTFExport variable.

  • On frxReport1Preview event , create your TfrxRTFExport.

  • On frxReport1ClosePreview event , Free your TfrxRTFExport.

Another solution :

If you have two button (Button 1 for the report2 , Button2 for the report1) then :

In Button 1 :

  • Free your TfrxRTFExport then show the report

In Button 2 :

  • Create your TfrxRTFExport , then show the report.