If you have ever looked for the watermark feature in Crystal Reports, you no doubt walked away smothered in soul-crushing despair wondering how Life could be so cruel.
True, there is no official tool in Crystal Reports that adds a watermark to a report, but that doesn’t mean it can’t be done. Adding a watermark just takes a bit of creativity and a handful of mouse click and keystrokes.
The trick is to add a subsection and underlay the following sections in the report. The steps are as follows:
1. In the Design View, right-click on the Page Header section (far left side of the screen) and select Insert Section Below.
You now have a new section labeled Page Header B.
2. Increase the height of the Page Header B section to approximately 5 inches. You may have to adjust this height in the final version to get the watermark to fall in the desired vertical position.
3. Add a text box to Page Header B and add the desired watermark text (i.e. “DRAFT”, “TOP SECRET”, or “For Internal Use ONLY”)
4. Right-click on the text box and select Format Text… Select the Font tab in the Format Editor Dialog box. Style the text to achieve the desired look. In this example, the following settings were applied:
- Font: ARIAL
- Font Color: SILVER
- Font Style: BOLD
- Font Size: 120pt (This value was typed directly into the font size field since it is not available in the font size dropdown list)
5. Click OK.
6. Right-click on the Page Header B section header and select Section Expert…
7. In the Section Expert Dialog box, select the Page Header B section on the left (if necessary) and check the box for Underlay Following Sections. Click OK.
8. Preview the report. You should now have a snazzy watermark resting neatly behind your data.
USING IMAGES AS WATERMARKS
It is also possible to add an image file to the watermark section. This is useful when adding a corporate logo as a watermark, but be aware that this will increase the report size relative to the size of the image file.
BONUS TRICK – MAKING YOUR WATERMARKS DYNAMIC
If you want to give the reader of the report the ability to customize the watermark, this can be accomplished by adding a parameter to the report to prompt the reader for the watermark text.
1. Return to the Design View
2. In the Field Explorer (right side of the screen), right-click on Parameter Field and select New…
3. In the Edit Parameter: Watermark Dialog box, type the name you wish to give the parameter (ex: “Watermark”) and ensure the data type is set to STRING. In the Prompt Text field, type the text that you want the reader to see in the pop-up box (ex: “Please enter your watermark:”). Click OK.
4. Delete the text box in the Page Header B section.
5. Drag and drop the Watermark parameter from the Field Explorer and drop it inside the Page Header B section. Format the Watermark parameter object with the same artistic settings as was done earlier with the text box.
The text box should look similar to the image below:
6. Preview the report. A prompt should appear requesting the text that will appear as the watermark. Enter the desired text and click OK.
The supplied text now appears as the watermark.
Each time you refresh the report, you will be prompted to either use the existing watermark text or update the watermark with new text.