Back to Devexpress

Document.WatermarkManager Property

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-document-cf0514c4.md

latest3.6 KB
Original Source

Document.WatermarkManager Property

Gets a manager that allows you to organize watermarks.

Namespace : DevExpress.XtraRichEdit.API.Native

Assembly : DevExpress.RichEdit.v25.2.Core.dll

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
WatermarkManager WatermarkManager { get; }
vb
ReadOnly Property WatermarkManager As WatermarkManager

Property Value

TypeDescription
WatermarkManager

An object that exposes methods used to manage watermarks.

|

Remarks

WatermarkManager allows you to add and remove watermarks without access to the watermark itself. You can use text or an image as a watermark.

Watermarks are located in section headers. If a document does not contain headers, WatermarkManager adds headers of the Primary type to all document sections.

If the document has multiple sections, WatermarkManager adds the same watermark to each section and each existing section header (first, primary, odd, or even).

The WatermarkManager.Type property indicates whether the document has watermarks. The property returns WatermarkType.None if the document does not contain watermarks.

Example

The code sample below adds a text watermark to all document pages.

csharp
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
    wordProcessor.LoadDocument("DocumentProtection.docx");

    TextWatermarkOptions textWatermarkOptions = new TextWatermarkOptions();
    textWatermarkOptions.Color = System.Drawing.Color.LightGray;
    textWatermarkOptions.FontFamily = "Calibri";
    textWatermarkOptions.Layout = WatermarkLayout.Diagonal;
    textWatermarkOptions.Semitransparent = true;

    wordProcessor.Document.WatermarkManager.SetText("CONFIDENTIAL", textWatermarkOptions);
    wordProcessor.SaveDocument("DocumentProtection_new.docx", DocumentFormat.Docx);
}
vb
Using wordProcessor As New RichEditDocumentServer()
    wordProcessor.LoadDocument("DocumentProtection.docx")

    Dim textWatermarkOptions As New TextWatermarkOptions()
    textWatermarkOptions.Color = System.Drawing.Color.LightGray
    textWatermarkOptions.FontFamily = "Calibri"
    textWatermarkOptions.Layout = WatermarkLayout.Diagonal
    textWatermarkOptions.Semitransparent = True

    wordProcessor.Document.WatermarkManager.SetText("CONFIDENTIAL", textWatermarkOptions)
    wordProcessor.SaveDocument("DocumentProtection_new.docx", DocumentFormat.Docx)
End Using

See Also

Document Interface

Document Members

DevExpress.XtraRichEdit.API.Native Namespace