ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / Editors / Report editor / Programming a report
  • Overview
  • Creating a watermark from the report viewer
  • Creating a watermark programmatically
  • Method 1: Full setting: using a Watermark variable
  • Method 2: Quick setting: direct use
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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 using this option, a specific window opens, allowing the user to define:
  • watermark destination: print and/or duplicate.
  • 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 programmatically
Different methods can be used to create a watermark through programming:

Method 1: Full setting: 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 duplicates
    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 setting: 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 duplicates
    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()
Minimum version required
  • Version 17
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 11/05/2024

Send a report | Local help