We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Restrict watermark manipulation

Hi Team!

I would like to ask a question about watermarking Word documents. I have already managed to watermark a docx file using Aspose.Words and my question is that is it possible somehow to programatically prevent the watermark of the processed document from getting modified or removed later?

I have been busy doing researches on this but the only option I have found so far that is quite similar to my expectations is this but watermark modification is still not impossible with this: https://apireference.aspose.com/words/net/aspose.words.settings/writeprotection/properties/readonlyrecommended

I would be grateful if you could answer my question.

Best regards,
Tamas Boldizsar

@tamas.boldizsar I think in your case, you can use editable ranges and make your document read-only. In this case you can allow editing only in the allowed areas, the rest of the document’s content will be protected. For example see the following code, it makes document’s body editable, but header/footer is protected:

Document doc = new Document(@"C:\Temp\in.docx");

doc.Watermark.SetText("This is my cool watermark");

DocumentBuilder builder = new DocumentBuilder(doc);
EditableRangeStart start = builder.StartEditableRange();

start.EditableRange.EditorGroup = EditorType.Everyone;

doc.Protect(ProtectionType.ReadOnly, "MyPassword");


Also you can try creating the expected document in MS Word and attach it here, we will check it and provide you more information.

1 Like


That’s great! I think your code snippet will help me a lot. Thank you!

One more question: is it also possible somehow to mark the document as final and make it read-only this way, just like in MS Word?

@tamas.boldizsar When you mark document as final in MS Word it sets two properties, built-in document property ContentStatus is set to Final and custom document property _MarkAsFinal is set to true. So you can use the following code to achieve this:

Document doc = new Document("C:\\Temp\\in.docx");
doc.BuiltInDocumentProperties.ContentStatus = "Final";
doc.CustomDocumentProperties.Add("_MarkAsFinal", true);
1 Like


Thank you for your help!


Hello again!

Finally I had time to experiment more deeply with Word watermarking and I have run into some unexpected problems so I would like to ask for help again.

I inserted a watermark to the header using Shape class just as described here and tried to protect the header/footer of the document with editable ranges just as you had suggested above. I have also attached my input and output documents in a zipped folder.

  1. When inserting the shape into the header, an extra newline character is also inserted along with the paragraph which offsets the body content a little unfortunately. I understand this mechanism but is it possible to get rid of that newline and append the shape to the end of the existing paragraph maybe?
  2. Regarding document protection, I found that the textbox in the document got uneditable as well which was not intended. What is the reason for that?
    Now I am afraid that other objects may also get protected unintentionally with this method.
    Is it possible somehow to specify allowed and restricted areas more precisely?
    Inside the headers, is it possible somehow to restrict editing the watermark object only and make all other header content editable?

I’d really appreciate if you could further help me.

Best regards,
Tamas Boldizsar

samples.zip (75.5 KB)


  1. Please use the following code to insert watermark into the document:
doc.Watermark.SetText("Test Watermark");

Document.Watermark provides a simple API for inserting and removing watermarks from the document.

  1. To make all areas editable you have to wrap all of them into editable ranges. This is a workaround, because editable ranges are supposed to be used to allow editing of some particular part of the documents content. This approach is not very effective because if someone wants to remove watermark or document protection, it can be easily done, for example, using Aspose.Words or by editing DOCX document xml files. So by adding a watermark to MS Word document, you have to rely on the end user honesty.
1 Like


Thank you very much!