|
|
|
|
|
- Overview
- Creating a report template
- Creating a report template
- Creating a report template from an existing report
- Applying a report template
- Creating a new report based on a report template
- Applying a template to an existing report
- Specific features of blocks
- Remarks
- Opening the template associated with a report
- Applying the modifications performed on a template
- Testing a report template
- List of templates used
- Synchronizing the reports and the report templates
WINDEV, WINDEV Mobile and WEBDEV allow you to create report templates. These templates contain the graphic elements and the code common to all the reports of your application. The changes made in a report template are automatically applied to all reports using this template. A report template allows you to comply with the style book defined for an application. Using report templates in your applications allows you to: - simplify the creation of reports in the application.
- simplify the layout of reports in the application.
- easily update the application style book.
Creating a report template A report template can be created: Creating a report template To create a report template: - Create a new report template:
- Click
in the quick access buttons. - The window for creating a new element appears: click on "Report", then on "Report template".
- The report editor displays a new report inside a green border named "Report template".
- Create all the necessary controls. These controls will be included in all reports that use the template.
- Enter (if necessary):
- the events associated with the report.
- the events associated with the different controls of the template.
These events will be automatically imported into the reports that use the template.
- Give your template a name ("General" tab of the description window).
- Save the report template (
or Ctrl + S).
The report template corresponds to a file whose extension is ".WTE". Creating a report template from an existing report To create a report template from an existing report: - Open the report that will be used as template.
- Keep the controls required by the template. These controls will be included in all reports that use the report template.
- Keep only the code of the events required by the template. These events will be automatically imported into the reports that use the template.
- Give a name to your report if necessary ("General" tab in the description window).
- On the "Home" tab, in the "General" group, expand "Save" and select "Save as template".
The current report becomes a template: - its name is preceded by "Template".
- a green border appears around the report in the report editor.
- the report template is displayed in the "Project explorer" pane in the "Report templates" folder.
The report template corresponds to a file whose extension is ".WTE". Applying a report template Creating a new report based on a report template To create a new report based on a report template: - Create a new report:
- Click
in the quick access buttons. - The window for creating a new element is displayed: click "Report" then "Report".
- The report creation wizard starts.
- Select the type of report to create. Proceed to the next step of the wizard.
- Choose your template from the list of available templates.
- End the wizard and validate. The new report is displayed in the editor.
A yellow square is used to identify the elements belonging to the report template. These elements can be modified: - in the report model: the modification will be effective for all reports using this model.
- in the status with mechanism for "control override": the modification will be effective for the status only.
Applying a template to an existing report To apply a template to an existing report: - Display the report in the report editor.
- On the "Modification" tab, in the "Templates and skin template" group, expand "Templates" and select "Inherit from a template".
- Select the report template to apply.
- Validate.
- Specify whether the report properties must be updated from the template. If you answer "Yes", the list of properties to override is displayed. In this window, select the properties of the initial report that must be kept. The report template will be automatically overridden for the properties kept. For all the other characteristics, the report will be automatically linked to the template.
- Validate.
Note: By default, the orientation characteristics and height of the report and its individual blocks are automatically overridden. Specific features of blocks A report contains unique blocks: start of document, top of page, body, bottom of page, end of document, etc. When a template is inserted into a report, the blocks of same type are automatically merged: - the code is automatically inherited (in a cumulative way if several templates are used),
- the properties are inherited,
- the block contains the controls found in the template and the ones found in the report.
Only the main template defines the properties of blocks. Special case: iteration blocks The iteration blocks are not unique blocks so they will not be merged. Remarks - Several templates can be applied to a report. In this case, the controls in the different templates are included in the report, as well as the events of these templates. The properties of the report (orientation, height of the blocks, ...) can be linked to a single template only.
- Templates do not support style overrides.
- The following elements cannot be used in the templates:
- arrays,
- breaks,
- data sources.
Opening the template associated with a report To open the template associated with a report: - Display the report in the report editor.
- In the context menu of a template element, select "Open template".
Other possibility: - List the models associated with the report: under the "Modification" pane, in the "Templates and skin template" group, pull down "Templates" and select "List of models used".
- Select the desired template and click "Open template".
Applying the modifications performed on a template When a report template is modified, the modifications can be applied to one ore more reports that use this template in the current project. Applying the modifications is proposed when the template is saved. It can also be performed at any time: - from the template: in the "Modification" pane, in the "Templates and skin template" group, scroll down to "Templates" and select "Update associated reports".
- from any report that uses the template, by opening the list of templates used:
- on the "Modification" tab, in the "Templates and skin template" group, expand "Templates" and select "List of templates used".
- click the "Update the selected template" button.
Remark: Model modifications are carried over according to the characteristics overridden in the reports that use the model. Testing a report template To run the test of a report template: - Open the report template whose test must be run:
- click its name in the project explorer.
- from a report that uses the report template (select "Open template" in the context menu of one of the controls for example).
- Click
.
To display the list of templates used for a report: - Open the requested report in the report editor.
- On the "Modification" tab, in the "Templates and skin template" group, expand "Templates" and select "List of templates used".
From this window, you can: - "Open a model": opens the selected model in the report editor.
- "Update": fields and template code are updated in the report.
- "Add": adds a model to the current state.
- "Disassociate": template fields present in the report are disassociated from the template.. The template is deleted from the list of templates used but its controls are not deleted from the report.
- "Delete": deletes the template (fields and code) from the report.
Synchronizing the reports and the report templates The reports and their templates can be synchronized when creating the executables, components, ... - Display the project description window: under the "Project" pane, in the "Project" group, click on "Description".
- Go to the "Options" tab of the project description.
- Check "Synchronize templates during generation".
Related Examples:
|
Training (WINDEV): WD Reports
[ + ] This example presents the different methods for creating a report: - prints based on different data sources (queries, variables, ...) - prints based on controls (Table, Spreadsheet, PVT, ...) - printing composite reports - specific prints (portrait/landscape, report with watermark, report with bar code, ...)
|
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|