ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Editors / Report editor / Programming a report
  • Overview
  • Creating a watermark from the report viewer
  • Creating a watermark through programming
  • Method 1: Full configuration: using a Watermark variable
  • Method 2: Quick configuration: direct use
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
A report (and a duplicate copy) can include an additional text in the format of a watermark, such as "Confidential" or "Duplicate" printed across the report.
The watermark can be created:
  • from the report viewer (WINDEV only).
  • programmatically.
Remarks:
  • If a watermark is defined for a report, it is defined for all the pages of the report.
  • A single watermark can be defined for each report. You cannot define several watermarks.
  • The watermark is printed on the pages containing information only. It is not printed on empty pages.
Creating a watermark from the report viewer
WINDEVReports and Queries On the "Annotate" tab of the report viewer, the "Watermark" option allows the user to create a watermark in the report being displayed.
When this option is selected, a specific window allows the user to define:
  • the destination of the watermark: print and/or duplicate copy.
  • the positioning of the watermark: ascending diagonal, descending diagonal or horizontal.
  • the text of the watermark, its font, its size, its color and its opacity.
    Entering the watermark in the preview
Creating a watermark through programming
Different methods can be used to create a watermark through programming:

Method 1: Full configuration: using a Watermark variable

This method is as follows:
  1. Define a Watermark variable. This variable contains all the characteristics of the watermark to print.
  2. Use iParameterWatermark to add the watermark into your report.
  3. Start printing the report.
For example:
  • WLanguage code used to print a watermark in the background of a report created with the report editor:
    // Print a watermark in report background
    MyWatermark is Watermark
     
    // Text of the watermark
    MyWatermark.Text = "Confidential"
    // Font used
    MyWatermark.Font.Name = "Arial"
    // The watermark will be horizontally centered at bottom
    MyWatermark.Position = iCenterH + iBottom
     
    // Print in the report viewer
    iDestination(iViewer)
     
    // Indicates that the watermark will be printed during the print
    // and in the duplicate copies
    iParameterWatermark(iWatermarkPrinting + ...
    iWatermarkDuplicate, MyWatermark)
     
    // Starts printing the report
    iPrintReport(RPT_Commercial)
  • WLanguage code used to print a watermark in the background of a report created with the print functions:
    MyWatermark is Watermark
     
    // Text of the watermark
    MyWatermark.Text = "Confidential"
     
    // Print in the report viewer
    iDestination(iViewer)
     
    // Implement a watermark in document background only
    iParameterWatermark(iWatermarkPrinting, MyWatermark)
     
    // Prints several pages with watermark
    FOR i = 6 TO 10
    iPrint(" Page " + i)
    iSkipPage()
    END
    // The last page is empty and it has no watermark
     
    // Ends the print job
    iEndPrinting()

Method 2: Quick configuration: direct use

This method is as follows:
  1. Use iParameterWatermark to specify the text of the watermark that will be added into your report. In this case, the "Arial" font is used, with an automatic size and with an opacity set to 20%.
  2. Start printing the report.
For example:
  • WLanguage code used to print a watermark in the background of a report created with the report editor:
    // Print in the report viewer
    iDestination(iViewer)
     
    // Indicates that the watermark will be printed during the print
    // and in the duplicate copies
    iParameterWatermark("Confidential")
     
    // Starts printing the report
    iPrintReport(RPT_Commercial)
  • WLanguage code used to print a watermark in the background of a report created with the print functions:
    // Print in the report viewer
    iDestination(iViewer)
     
    // Implement a watermark in document background only
    iParameterWatermark(iWatermarkPrinting, "Confidential")
     
    // Prints several pages with watermark
    FOR i = 6 TO 10
    iPrint(" Page " + i)
    iSkipPage()
    END
    // The last page is empty and it has no watermark
     
    // Ends the print job
    iEndPrinting()
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 17
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help