PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Overview
  • "Opening" event of the report
  • Execution of the event
  • Password of the data file used as source for the report
  • Initializing variables
  • Use examples
  • Event "Reading data"
  • Execution of the event
  • Reports based on a text file
  • Use examples
  • Event "Filtering (taking the record into account?)"
  • Execution of the event
  • Using the Filter event
  • Use examples
  • "Closing" event of the report
  • Execution of the event
  • Use examples
  • Event "Before printing the report again"
  • Execution of the event
  • Use examples
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Overview
The following events are associated to reports (order of appearance in the code editor):
Several events are associated with the reports. These events are run when printing the report.
To know the execution order of these events, see Sequence of events associated with reports.
"Opening" event of the report

Execution of the event

The "Opening" event of the report is run when starting the report print.
Reminder: When starting a report (including during a test), the events are run in the following order:

Password of the data file used as source for the report

If the data file used as source for the report is password protected, this password must be specified before opening the data file (by HPass for example).
If the data file was not opened before printing the report, the password can be specified in the "Opening" event of the report.
WINDEV

Initializing variables

When printing a report from the print preview, the report is automatically re-run when:
  • the user changes printer.
  • the user uses one of the toolbar buttons (print in PDF mode, in HTML mode, in an email, ...).
In this case, the data printed in the report can differ from the data displayed in the preview.
The variables used by the report should be initialized in the "Opening" event rather than in the code of the button that starts the print.

Use examples

This event is used to:
  • declare the global variables of the report.
  • modify the report bounds with ..MinValue and ..MaxValue.
  • initialize the passwords of data files if necessary.
  • configure the destination of the print (iPreview).
  • pass parameters to the query linked to the report (iInitReportQuery).
  • retrieve the parameters passed to the report.
  • change the data source of the report.
Note: iPrint must not be used in the report opening event.
Event "Reading data"

Execution of the event

This event is run when browsing the records to print (in the print loop), once the record has been read.

Reports based on a text file

For reports based on a text file (with programmed reading), the event "Reading data" is used to read the records in the text file in order to print them.

Use examples

This event is used to:
  • perform block substitutions (as the next record to print is known).
  • select records.
  • perform specific calculations.
Note: This code returns True if there are still records to print and False if there is no record to print.
If you do not want to print a record, use the event "Filtering (taking the record into account?)".
Event "Filtering (taking the record into account?)"

Execution of the event

This event is run:
  • when the data source is initialized (reports based on a data file, a view or a memory zone).
  • in the print loop, once the record is read (reports based on a query or on a Table control).
This event filters the records displayed in the report.

Using the Filter event

If there are lines of code in this event, they must return a value:
  • Cancel to stop reading the records (and to stop the print).
  • True to specify that the record matches the filter and that it must be printed.
  • False to specify that the record does not match the filter and that it must not be printed.

Use examples

This event is used to:
  • select records.
  • perform advanced calculations (sub-total, ...) for the reports based on files, views or memory zones.
"Closing" event of the report

Execution of the event

This event is run once the report has been printed, just before closing the report.
This event must not contain print functions.
Versions 21 and later
Note: iCurrentFile is used to find out the name of the file generated for the report (for the exports in PDF, HTML, ...).
New in version 21
Note: iCurrentFile is used to find out the name of the file generated for the report (for the exports in PDF, HTML, ...).
Note: iCurrentFile is used to find out the name of the file generated for the report (for the exports in PDF, HTML, ...).

Use examples

This event is used to:
Versions 21 and later
WINDEV
Event "Before printing the report again"

Execution of the event

This event is run when printing from the print preview (direct print or export to PDF, XLS, RTF, etc.).
This event is run after the "Opening" event of the report.
If this event returns:
  • True, the re-print will be performed.
  • False, the re-print will be canceled.
Notes:
  • iDestination used in this event allows you to find out the destination of the report (HTML, PDF, etc.).
  • iCurrentFile used in this event allows you to find out the name of the file generated for the report (for exports in PDF, HTML, etc.).

Use examples

This event is used to:
  • find out the quality of the generated PDF before the export in PDF format.
  • add a watermark.
  • ask for a password before the print or the export.
New in version 21
WINDEV
Event "Before printing the report again"

Execution of the event

This event is run when printing from the print preview (direct print or export to PDF, XLS, RTF, etc.).
This event is run after the "Opening" event of the report.
If this event returns:
  • True, the re-print will be performed.
  • False, the re-print will be canceled.
Notes:
  • iDestination used in this event allows you to find out the destination of the report (HTML, PDF, etc.).
  • iCurrentFile used in this event allows you to find out the name of the file generated for the report (for exports in PDF, HTML, etc.).

Use examples

This event is used to:
  • find out the quality of the generated PDF before the export in PDF format.
  • add a watermark.
  • ask for a password before the print or the export.
WINDEV
Event "Before printing the report again"

Execution of the event

This event is run when printing from the print preview (direct print or export to PDF, XLS, RTF, etc.).
This event is run after the "Opening" event of the report.
If this event returns:
  • True, the re-print will be performed.
  • False, the re-print will be canceled.
Notes:
  • iDestination used in this event allows you to find out the destination of the report (HTML, PDF, etc.).
  • iCurrentFile used in this event allows you to find out the name of the file generated for the report (for exports in PDF, HTML, etc.).

Use examples

This event is used to:
  • find out the quality of the generated PDF before the export in PDF format.
  • add a watermark.
  • ask for a password before the print or the export.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment