Skip to main content
A newer version of this page is available.

XtraReport.Watermark Property

Provides access to a report’s watermark settings.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v20.2.dll

NuGet Packages: DevExpress.Reporting.Core, DevExpress.WindowsDesktop.Reporting.Core

Declaration

[SRCategory(ReportStringId.CatAppearance)]
public XRWatermark Watermark { get; }

Property Value

Type Description
XRWatermark

An XRWatermark object that specifies the report’s watermark.

Remarks

You can provide a text or a picture watermark to your report via the XRWatermark.Text and XRWatermark.ImageSource properties.

Use the XRWatermark.PageRange property to specify which pages should show the watermark.

See Add Watermarks to a Report for information on how to add a watermark to a report at design time.

The following image illustrates the HtmlExportOptionsBase.ExportWatermarks property in the HTML Export Options dialog. It specifies whether or not to maintain the report’s text and image watermarks in an HTML file.

html-export-options-watermarks

This option is available when the HtmlExportOptionsBase.ExportMode property is set to either HtmlExportMode.SingleFilePageByPage, or HtmlExportMode.DifferentFiles.

The display of a document watermark is not supported by Internet Explorer 7 and 8.

Example

This example demonstrates how to add a watermark to a report. The SetTextWatermark method demonstrates the properties you can use to add a text watermark to a report; the SetPictureWatermark method demonstrates properties required to set a picture as the report’s watermark.

using System.Drawing;
using DevExpress.XtraPrinting;
using DevExpress.XtraPrinting.Drawing;
// ...
public void SetTextWatermark(XtraReport report) {
    Watermark textWatermark = new Watermark();
    textWatermark.Text = "CUSTOM WATERMARK TEXT";
    textWatermark.TextDirection = DirectionMode.ForwardDiagonal;
    textWatermark.Font = new Font(textWatermark.Font.FontFamily, 40);
    textWatermark.ForeColor = Color.DodgerBlue;
    textWatermark.TextTransparency = 150;
    textWatermark.ShowBehind = false;
    textWatermark.PageRange = "1,3-5";
    report.Watermark.CopyFrom(textWatermark);
}
public void SetPictureWatermark(XtraReport report) {
    Watermark pictureWatermark = new Watermark();
    pictureWatermark.ImageSource = ImageSource.FromFile("Watermark.png");
    pictureWatermark.ImageAlign = ContentAlignment.TopCenter;
    pictureWatermark.ImageTiling = false;
    pictureWatermark.ImageViewMode = ImageViewMode.Stretch;
    pictureWatermark.ImageTransparency = 150;
    pictureWatermark.ShowBehind = true;
    pictureWatermark.PageRange = "2,4";
    report.Watermark.CopyFrom(pictureWatermark);
}
See Also