Sign in Join
Wiki copytemporary

FPReport Lazarus support: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: FPReport Lazarus support

OldNewLine
1+## Package
2+
3+The lazidefpreport package contains the support for fpreport. It can be installed in the IDE, and then the following components appear on the component palette:
4+
5+TFPReport
6+The basic report. Only use this component if you intend to do everything (creating report, adding data) manually.
7+
8+It does not write any properties to the .lfm file. You can use the designer to design a report, but you must save the design to file and load it manually at runtime, as desrcibed in [[FPReport Usage]].
9+
10+TFPJSONReport
11+This is the basic report which you should normally be using. The report design is saved in the .lfm form file. You can of course use the LoadFromFile/SaveToFile commands to load from file.
12+
13+TFPReportDesigner
14+Drop this on a form if you want to add designing capabilities to your executable. This allows the end-user to manipulate the design of the report. The possibilities offered to the end-user can be specified in the options.
15+
16+TFPReportUserData
17+This is a simple, event-driven, report loop. You can set the field definitions, and use the events to provide the data to the report. Note that you cannot preview the report in the designer, since the event handlers cannot be executed in the designer.
18+
19+TFPReportDatasetData
20+This class offers data to the report from a dataset. The dataset will be opened to get the list of field names.
21+
22+TFPReportJSONData
23+This class offers data from a JSON structure to the dataset.
24+
25+TFPReportCollectionData,
26+This class offers data from a collection to the dataset. The collection must be specified at runtime. When using this component, you cannot preview the report in the designer, since the data is not available.
27+
28+TFPReportObjectListData,
29+This class offers data from a list to the dataset. The collection must be specified at runtime. When using this component, you cannot preview the report in the designer, since the data is not available.
30+
31+TFPReportExportHTML,
32+Drop this component on a form to export the data from the report to HTML files.
33+
34+TFPReportExportfpImage,
35+Drop this component on a form to export the data from the report to image files.
36+
37+TFPReportExportPDF,
38+Drop this component on a form to export the data from the report to PDF files.
39+
40+TFPreportPreviewExport,
41+Drop this component on a form to export the data from the report to screen, i.e. preview the report.
42+
43+TFPreportPrinterExport
44+Drop this component on a form to export the data from the report to printer.
45+
46+## TFPReport and TFPJSONReport component editor
47+
48+The component editor for the TFPReport and TFPJSONReport components has the following entries:
49+
50+Design Report
51+This will show the report designer. From within the designer, the report data cannot be managed.
52+
53+Note that if you design a TFPReport instance, you must save the design to file.
54+
55+Only the TFPJSONReport component will save the definition to the .lfm file.
56+
57+Assign local data
58+This will check the form for TFPReportData instances, and allows you to select the instances that should be added to the report data sources.
59+
60+You can also do this manually, by editing the ReportData collection.
61+
62+Preview Report
63+This will preview the report, preparing it if necessary.
64+
65+Note that this will only work with dataset based data, since none of the event handlers for user/collection/list data can be executed in the IDE.
66+
67+Run Report
68+This will prepare the report.
69+
70+## TFPReportDesigner component editor
71+
72+The TFPReportDesigner has a component menu editor which allows you to show the editor.
73+
74+## Export components editors
75+
76+The various export components share a component menu editor which allows you to configure the export, and to actually execute the export. For this you must have prepared the report.
77+
78+## Basic usage
79+
80+To create a report for which the design is stored in the .lfm file, the following steps are necessary:
81+
82+1. Drop a TFPJSONReport instance on a form or data module
83+2. Drop one or more TFPReportData descendents on the form or data module and configure them correctly.
84+3. Connect the data to the report (you can use the 'Assign local data' component editor menu entry for this)
85+4. Design the report. Make sure you save the design.
86+5. Drop an export component and/or a preview component on the form/datamodule.
87+
88+When this is done, the report is ready for use
89+
90+1. At runtime, run the report, and export it using one of the export components.
91+
92+## TFPReport vs. TFPJSONReport
93+
94+In general, you should use TFPJSONReport: it has the ability to store the design in the form file, or can easily load/save report designs from file. Unless you want to do everything in code, the use of TFPReport is not really recommended.
95+
96+## Navigation to other pages
97+
98+1. [[FPReport]]
99+2. [[FPReport Usage]]
100+3. [[FPReport Designer]]
101+4. [[FPReport Custom elements]]
102+
103+---
104+*From the Free Pascal wiki, page "FPReport Lazarus support", as it stood on 2018-03-08 after a change by Djzepi, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history