Free Support Forum -

How to Add or Remove watermarks

Hi, to all
I have the question to how to add or remove watermarks by aspose.words.dll v14.2 based on 2008.
the codes to remove watermarks as follow:

Public Function DelWaterArt(ByVal filename As String, ByVal dFile As String,Optional byval WaterText as string ="") As Boolean
    Dim doc As New Aspose.Words.Document(filename)
     Dim Nodes As NodeCollection
    Nodes = doc.GetChildNodes(NodeType.Shape, True)
    If Nodes Is Nothing Or Nodes.Count < 1 Then
        doc = Nothing
        On Error Resume Next
        FileCopy(filename, dFile)
        Dim Shapes() = Nodes.ToArray()
        Dim count As Long = Shapes.Length
        For i As Long = 0 To count - 1
            Dim shape = Shapes(i)
            Dim t = shape.GetText()
             If t="" or t=WaterText Then
             End If
        On Error Resume Next
    End If

End Function

As shown for the above codes, all the shapes besides the true watermark shapes in the documents have been deleted! Actually, the shapes like customized shapes, WaterArt shapes, TextBoxs must not be considered as watermark and they cannot be deleted!
Any one knows how to remove true watermarks and keep the customized shapes, WaterArt shapes, TextBoxs shapes?

In addition, after clearing the watermarks, what codes can add/update new watermarks(plain text or image) to the main document besides the head/footer sections.

Thanks in advance!



Thanks for your inquiry. To remove the watermark, you need to set the name or alternative text of Shape node and use ShapeBase.AlternativeText or Shape.Name property to identify the watermark and remove it using Shape.Remove method. We suggest you please read the following article. Hope this helps you.
Working with Watermark

Thanks for your answer!
But the names or alternative texts of shapes are unknown so that the codes cannot remove the given watermarks by identifying its name or alternative text. Is there any solution for this objective?


Thanks for your inquiry. Please ZIP and attach your input and expected output Word documents here for our reference. We will then provide you more information about your query.

Thanks for your reply!
Please download the demo files for your reference at
one file is for input file, one file is for desired and correct output file, and one file is not expected and incorrect output file generated by aspose.words.dll version 14.2. based on 2008.


Thanks for sharing the detail. Please use the following code example to get the desired output. Hope this helps you.

Dim doc As Document = New Document(MyDir + "Test File for Removing watermarks.docx")
For Each section As Section In doc.Sections
    For Each headerFooter As HeaderFooter In section.HeadersFooters
        For Each shape As Shape In headerFooter.GetChildNodes(NodeType.Shape, true)
            If shape.IsWordArt Then
            End If
doc.Save(MyDir + "18.11.docx")

It’s done! Thank you very much!