You are currently reviewing an older revision of this page.
Data can be read from the project database and displayed on reports by simply dragging a data field onto the report template in Report Template Designer. It is possible to manipulate data from the database or otherwise before it is displayed on the report by using scripts in Report Template Designer. This document describes how to use OnBeforePrint scripts as a reference for other articles. See the articles listed in the See Also section for specific OnBeforePrint script examples.
OnBeforePrint scripts "overwrite" the contents of the table cell or label they are applied to, even if a data field is bound to the cell or label.
Open a project page using Project Manager.
Open Report Template Designer.
Select File > Open and open the report template.
In the Designer view (Designer tab along the bottom of the Report Template Designer), find the table cell or Label that the script is to affect. Right-click this cell or label and select Properties.
On the resulting Property Grid view, expand the Scripts row. The Scripts row is in the Behavior category.
Click on the OnBeforePrint row.
Click the down arrow button that appears in that row.
Paste or compose the intended script within the curly brackets { } of the new function. private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { // paste script here}
Preview the report by clicking the Preview tab.
If the results are acceptable, use File > Save to save the template or File > Save As to save it as a new template.
Close the Report Template Designer.
To modify an existing script, click the Scripts tab at the bottom of Report Template Designer and find the script.
On the resulting Property Grid view, expand the Scripts row.
Click the [...] button that appears in that row. This will open a Script Editor dialog showing the current script for the OnBeforePrint event.
Paste, compose, or modify the intended script within the curly brackets { } of the function. private void OnBeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e) { // paste script here}
To modify a script, repeat steps 4 through 7.
To remove a script, repeat steps 4 through 7 and click the Default Script button on the Script Editor dialog.
Removing Terminal CP Text from Wire Lists
Scripting Overview - DevExpress