We can add text watermark using ASPOSE Word in word file programmatically in C# console application. But we are facing issue while removing the watermark from the file.
We tried below code to remove watermark from file but it’s not working:
Document doc = new Document(filePath);
if (doc.Watermark.Type == WatermarkType.Text)
{
doc.Watermark.Remove();
}
doc.Save(filePath);
Also attaching the word document in which it’s not working.
We use this code mentioned here to add a watermark.
After programmatically adding watermark in word file, if user edits the document in word application, it sets this watermark as a WordArt. Is there anything specific reason behind this?
@dikesh.gandhi Watermark is a shape in header with specific Name attribute value (WordArt shape for text watermark to be precise). Both Aspose.Words and MS Word recognize watermarks by this attribute. If you insert a text watermark in Aspose.Words by the Document.Watermark.SetText method, the name attribute value will be specified as expected. This watermark could be removed from the document by Document.Watermark.Remove() method. Also this document could be edited in MS Word and watermark name attribute will be preserved.
@NensonM If you need to place text watermark it is inserted as WordArt Shape, please see Document.Watermark.SetText method. If it is required to insert an image watermark it is inserted as an Image Shape, see Document.Watermark.SetImage.