Hi, to all
I have the question to how to add or remove watermarks by aspose.words.dll v14.2 based on VB.net 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) Else 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 shape.Remove() End If Application.DoEvents() Next On Error Resume Next doc.Save(dFile) 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!