XtraReport.Watermark Property
Provides access to a report’s watermark settings.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v18.2.dll
Declaration
Property Value
Type | Description |
---|---|
XRWatermark | An XRWatermark object, specifying the report’s watermark. |
Remarks
You can provide a text or a picture watermark to your report via the PageWatermark.Text and PageWatermark.Image properties respectively.
To specify the pages that will show the watermark, use the Watermark.PageRange property.
The following image illustrates the HtmlExportOptionsBase.ExportWatermarks property in the HTML Export Options dialog. It specifies whether or not to maintain the existing text and image watermarks of a report in an HTML file.
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 properties that are useful when adding a text watermark to a report, while the SetPictureWatermark method demonstrates properties required to set a picture as the report’s watermark.
using System.Drawing;
using DevExpress.XtraPrinting.Drawing;
using DevExpress.XtraReports.UI;
// ...
public void SetTextWatermark(XtraReport report){
// Adjust text watermark settings.
report.Watermark.Text = "CUSTOM WATERMARK TEXT";
report.Watermark.TextDirection = DirectionMode.ForwardDiagonal;
report.Watermark.Font = new Font(report.Watermark.Font.FontFamily, 40);
report.Watermark.ForeColor = Color.DodgerBlue;
report.Watermark.TextTransparency = 150;
report.Watermark.ShowBehind = false;
report.Watermark.PageRange = "1,3-5";
}
public void SetPictureWatermark(XtraReport report){
// Adjust image watermark settings.
report.Watermark.Image = Bitmap.FromFile("watermark.gif");
report.Watermark.ImageAlign = ContentAlignment.TopCenter;
report.Watermark.ImageTiling = false;
report.Watermark.ImageViewMode = ImageViewMode.Stretch;
report.Watermark.ImageTransparency = 150;
report.Watermark.ShowBehind = true;
report.Watermark.PageRange = "2,4";
}