Back to Devexpress

WatermarkManager.Remove(Section, HeaderFooterType) Method

officefileapi-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-watermarkmanager-dot-remove-x28-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-section-devexpress-dot-xtrarichedit-dot-api-dot-native-dot-headerfootertype-x29.md

latest2.9 KB
Original Source

WatermarkManager.Remove(Section, HeaderFooterType) Method

Removes a watermark from a header of the specified section.

Namespace : DevExpress.XtraRichEdit.API.Native

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

NuGet Package : DevExpress.RichEdit.Core

Declaration

csharp
void Remove(
    Section section,
    HeaderFooterType type
)
vb
Sub Remove(
    section As Section,
    type As HeaderFooterType
)

Parameters

NameTypeDescription
sectionSection

The target section.

| | type | HeaderFooterType |

The type of the section’s header that contains the watermark to be removed.

|

Remarks

The example below adds a text watermark to all document sections and then removes the watermark from the last section.

csharp
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.API.Native;
// ...

document.LoadDocument(@"Documents\Watermarks.docx");

// Add a text watermark to the document.
document.WatermarkManager.SetText("DO NOT COPY");

// Remove the watermark from the last section.
var lastSection = document.Sections[document.Sections.Count - 1];
document.WatermarkManager.Remove(lastSection, HeaderFooterType.Primary);

document.SaveDocument(@"Documents\WatermarksUpd.docx", DocumentFormat.Docx);
vb
Imports DevExpress.XtraRichEdit
Imports DevExpress.XtraRichEdit.API.Native
' ...

document.LoadDocument("Documents\Watermarks.docx")

' Add a text watermark to the document.
document.WatermarkManager.SetText("DO NOT COPY")

' Remove the watermark from the last section.
Dim lastSection As Section = document.Sections(document.Sections.Count - 1)
document.WatermarkManager.Remove(lastSection, HeaderFooterType.Primary)

document.SaveDocument("Documents\WatermarksUpd.docx", DocumentFormat.Docx)

The following image demonstrates the result:

See Also

WatermarkManager Interface

WatermarkManager Members

DevExpress.XtraRichEdit.API.Native Namespace