Script
Script is a higher-level programming language, which is part of the report. Script can be written in one of the following .Net languages:
- C#
- VisualBasic.Net
A script is applicable in many places. Using the script, you can do the following:
- perform data handling, which cannot be done via regular means of the FastReport engine;
- control the printing of report pages and bands on the page;
- control the interaction between elements on dialogue forms;
- control the formation of dynamic "Table" objects;
- and many more.
In order to see the report's script, switch to the "Script" tab in the designer:
In the figure you can see the "Events" window for the object Page1. This window allows you to create event handlers for components and bands.
In the script, you can:
- add your variables, methods and properties to the main script class;
- create a report object's events handler;
- add new classes to the script, if needed. A class can be added either before the ReportScript main class or after it.
You cannot:
- delete, rename or change the visibility area of the ReportScript main class;
- rename a namespace in which the main class is located.
When the report is running, the following occurs:
- FastReport adds into the script a list of variables, whose names correspond with the names of the report objects. This is done before compiling the script and allows you to refer to the report objects by their names;
- an expression handler is added to the script, which handles all expressions found in the report;
- a script is compiled, if it is not empty;
- the script class is initialized;
- the report is run.