ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Report editor / Operations in the editor
  • 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
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Overview
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

Creating a report template

To create a report template:
  1. Create a new report template:
    • Click in the quick access buttons.
    • The new element window appears: click on "Report", then on "Report template".
    • The report editor displays a new report inside a green border named "Report template".
  2. Create all the necessary controls. These controls will be included in all reports that use the template.
  3. 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.
  4. Give your template a name ("General" tab of the description window).
  5. 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:
  1. Open the report that will be used as template.
  2. Keep the controls required by the template. These controls will be included in all reports that use the report template.
  3. Keep only the code of the events required by the template. These events will be automatically imported into the reports that use the template.
  4. Give a name to your report if necessary ("General" tab in the description window).
  5. 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:
  1. Create a new report:
    • Click in the quick access buttons.
    • The new element window appears: click "Report" then "Report".
    • The report creation wizard starts.
  2. Select the type of report to create. Go to the next step of the wizard.
  3. Choose your template from the list of available templates.
  4. 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 template: the modification will be effective for all the reports that use this template.
  • in the report by the mechanism for "control override": the modification will be effective for the report only.

Applying a template to an existing report

To apply a template to an existing report:
  1. Display the report in the report editor.
  2. On the "Modification" tab, in the "Templates and skin template" group, expand "Templates" and select "Inherit from a template".
  3. Select the report template to apply.
  4. Validate.
  5. 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.
  6. Validate.
Remark: By default, the orientation characteristics as well as the height of the report and its different blocks are automatically overridden.

Specific features of blocks

A report contains unique blocks: start of document, page header, body, page footer, end of document, ...
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: the 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:
  1. Display the report in the report editor.
  2. In the context menu of a template element, select "Open template".
Other possibility:
  1. List the templates associated with the report: on the "Modification" tab, in the "Templates and skin template" group, expand "Templates" and select "List of templates used".
  2. 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: on the "Modification" tab, in the "Templates and skin template" group, expand "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: The modifications made to the template are propagated according to the overridden characteristics of the reports that use the template.
Testing a report template
To run the test of a report template:
  1. 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).
  2. Click .
List of templates used
To display the list of templates used for a report:
  1. Open the requested report in the report editor.
  2. 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 template": opens the selected template in the report editor.
  • "Update": the controls and the code of the template are updated in the report.
  • "Add": adds a template to the current report.
  • "Dissociate": the template controls found in the report are dissociated 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 (controls 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, ...
  1. Open the project description window: on the "Project" tab, in the "Project" group, click "Description".
  2. Display the "Options" tab of the project description.
  3. Check "Synchronize templates during generation".
Related Examples:
WD Reports 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, ...)
Minimum version required
  • Version 14
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/23/2023

Send a report | Local help