Pismatically create MEMO in FastReport

xiaoxiao2021-03-06  27

For FastReport, it uses your own program code to dynamically create a report form, just like a VCL object. This example can be found from the runtime subdirectory. In this example, when pressing the button, a report from a Customer.db data table receiving a list of companies will be created. The source code for this button's OnClick event is displayed as follows: Procedure TFORM1.BUTTON1CLICK (Sender: Tobject); VAR V: TFRView; B: TfrbandView; Page: TFRPAGE; Create Page Page: = frReport1.pages [0];

B: = TFRBAndView (frcreateObject (gtband, '')); // Create MasterData Band B.SetBounds (0, 20, 0, 20); B.BandType: = btmasterData; b.dataset: = 'frDbdataSet1'; Page. Objects.Add (b);

v: = frcreateObject (gtmemo, ''); // Create Data Field V.SetBounds (20, 20, 200, 16); v.Memo.add ('[Table1. "Company"); page.Objects. Add (v);

FRREPORT1.SHOWREPORT; END; First of all this code deletes all available pages in the report, then create a blank page: frReport1.pages.clear; frReport1.pages.add; // create page then creates "Main Item" on this page Area, and specify data sources: Page: = frReport1.pages [0];

B: = TfrbandView (frcreateObject (gtband, '')); // Create MasterData Bandb.SetBounds (0, 20, 0, 20); B.BandType: = btmasterdata; b.DataSet: = 'frDbdatatet1'; Page.Objects .Add (b); Next is to create a "text" object and specify the Company field to the Customer.db data table: v: = frcreateObject (gtmemo, ''); // Create Data Fieldv.setBounds (20, 20 , 200, 16); v.Memo.add ('[Table1. "Company"]'); page.objects.add (v); finally using event handling in preview preparation report

转载请注明原文地址:https://www.9cbs.com/read-40876.html

New Post(0)