TextWatermarkOptions Class
Contains text watermark options.
Namespace: DevExpress.XtraRichEdit.API.Native
Assembly: DevExpress.RichEdit.v21.1.Core.dll
NuGet Package: DevExpress.RichEdit.Core
Declaration
Example
The code sample below adds a text watermark:
using (RichEditDocumentServer wordProcessor = new RichEditDocumentServer())
{
wordProcessor.LoadDocument("DocumentProtection.docx");
// Check whether the document sections have headers:
foreach (Section section in wordProcessor.Document.Sections)
{
if (!section.HasHeader(HeaderFooterType.Primary))
{
// If not, create an empty header
SubDocument header = section.BeginUpdateHeader();
section.EndUpdateHeader(header);
}
}
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.OpenXml);
}
Inheritance
Object
TextWatermarkOptions
See Also