The previous article introduced how to export reports in ActievReport. This article briefly introduces important events in ActiveReport.
1. Only one event is triggered:
ReportStart:Triggered when the report is started. This event is in DataInitialize Previously, the objects or variables used in the entire report can be initialized here, or subreports can be set.
DataInitialize : This event often appears in the previous articles, where data is often taken, data sources are bound, and Fileds attributes of reports are set.
ReportEnd:Triggered after the report is loaded.
2. events that are triggered multiple times:
FetchData :It is triggered when processing each piece of data. If you bind a data source, you do not need to assign values to each Field in Fields. To extract data from a custom object set, assign a value to Fields. In addition, when using a custom set, you must set the EOF attribute of the eArgs parameter of the event. This attribute is used to determine whether the last record is displayed. If yes, It is set to true, and return directly. For specific code, see the previous document.
PageStart :Triggered when a report is generated on each page. Here, we process each page. The most common is to display the page number.
PageEnd :Triggered when each report is generated.
3. Regional Events:
Each region (PageHeader, Detail, PageFooter) has the Format, BeforePrint, and AfterPrint events. It is better not to operate the Fields set of reports in these events, but in DataInitialize and FetchData.
Format:Triggered after data is loaded and bound. The height of a region can be set only here.
BeforePrint:Triggered before a region is generated. If the region height is set here, it will not be effective, and do not operate the data source here.
AfterPrint:After a region has been generated and illustrated, you can draw an image directly on the canvas in this event.