Support for Delphi 10.1 Berlin
Hello,
I'm creating a PDF file from a template with an OnBeforePrint event. The report script works fine in FR 4 in Delphi 2010, but doesn't run in Delphi 10.1 Berlin with FastReport 5.
The code example is the following:
oExportFilter := TfrxExportPDF.Create(nil); try if FReport.PrepareReport then //script runs in PrepareScript function inside for version 4 begin //export FReport to PDF end; finally oExportFilter.Free; end;
I try this code with the same result:
with FReport do begin Freport.ScriptText.Clear; //clear script text Freport.ScriptText.Add('procedure PageFooter1OnBeforePrint(Sender: TfrxComponent);'); Freport.ScriptText.Add('Begin'); Freport.ScriptText.Add('Memotest.Color := $00FF0000;'); Freport.ScriptText.Add('end;'); Freport.ScriptText.Add('Begin'); Freport.ScriptText.Add('PageFooter1.OnbeforePrint :='+''''+'PageFooter1OnBeforePrint'+''''+';'); Freport.ScriptText.Add('end.'); FReport.ShowReport; end;
The only problem is the report script. Has Embarcadero Rad Studio 10.1 Berlin support for FastScript? How to validate it?
Thanks in advance.
Comments
Add export filters support.
In the Delphi:
frxReport1.Script.AddClass(TfrxCustomExportFilter, 'TComponent');
frxReport1.Script.AddClass(TfrxCustomImageExport, 'TfrxCustomExportFilter');
frxReport1.Script.AddClass(TfrxBMPExport, 'TfrxCustomImageExport');
frxReport1.Script.AddClass(TfrxRTFExport, 'TfrxCustomExportFilter');
...
frxReport1.Script.AddObject('frxRTFExport1',frxRTFExport1);
frxReport1.Script.AddObject('frxBMPExport1',frxBMPExport1);
...
In the script
frxRTFExport1.FileName := 'myFilename.rtf';