How do I add a Watermark to a report layout?
In any report (EXCEPT letters) add the following lines.
In the BeforeOpenTables method of the report file add following code at the beginning
_Screen.oFoxyPreviewer.cWatermarkImage = 'Imagefile.png' && your image file eg png,bmp,jpg..
_Screen.oFoxyPreviewer.nWaterMarkType = 1 && 1 = Coloured (default), 2 = B&W
_Screen.oFoxyPreviewer.nWatermarktransparency = .20 && (0-1) Transparency, 0 = Transparent
_Screen.oFoxyPreviewer.nWaterMarkWidthRatio = .75 && (0-1) Proportion in the page width
_Screen.oFoxyPreviewer.nWaterMarkHeightRatio = .75 && (0-1) Proportion in the page height
You may need to adjust the above values to suit client requirements.
In the Destroy method of the report add the following code to stop any subsequent reports printing a watermark.
_Screen.oFoxyPreviewer.cWatermarkImage = ''
_Screen.oFoxyPreviewer.nWaterMarkType = 0
_Screen.oFoxyPreviewer.nWatermarktransparency = 0
_Screen.oFoxyPreviewer.nWaterMarkWidthRatio = 0
_Screen.oFoxyPreviewer.nWaterMarkHeightRatio = 0
- If the report is going to be a large quantity of pages, you may want the Image to be not a large file as this will slow the report considerably.
- The Try … Catch surround in the above code will stop any errors in this code segment. So if the report does not find foxy or the image file does not exist, no errors will be produced and the report will continue.
- Hint: Use Copy (code above) and Paste into Report methods and edit to suit.