C#/VB.NET: Remove Text or Image Watermarks from Word Documents

2022-06-24 08:50:00 Written by  support iceblue
Rate this item
(0 votes)

Watermarks can be added to Word documents to inform other people about the documents' ownership or status. Sometimes, you may want to get rid of an existing watermark in a Word document. This article will demonstrate how to remove watermarks from Word documents in C# and VB.NET using Spire.Doc for .NET.

Install Spire.Doc for .NET

To begin with, you need to add the DLL files included in the Spire.Doc for .NET package as references in your .NET project. The DLL files can be either downloaded from this link or installed via NuGet.

PM> Install-Package Spire.Doc

Remove Text or Image Watermarks from Word Documents in C# and VB.NET

You can remove the watermark of a Word document by setting the Document.Watermark property as null.

The following steps show you how to remove the watermark from a Word document:

  • Initialize an instance of Document class.
  • Load a Word document using Document.LoadFromFile() method.
  • Remove the watermark from the document by setting the Document.Watermark property as null.
  • Save the result document using Document.SaveToFile() method.
  • C#
  • VB.NET
using Spire.Doc;

namespace RemoveWatermark
{
    class Program
    {
        static void Main(string[] args)
        {
            //Create a Document instance
            Document doc = new Document();
            //Load a Word document
            doc.LoadFromFile("Sample.docx");

            //Remove the watermark from the document
            doc.Watermark = null;

            //Save the result document
            doc.SaveToFile("RemoveWatermark.docx", FileFormat.Docx2013);
        }
    }
}

C#/VB.NET: Remove Text or Image Watermarks from Word Documents

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Additional Info

  • tutorial_title:
Last modified on Wednesday, 31 May 2023 09:13