Add or Remove Watermark in Word (DOC/DOCX) using C++

Add Remove Watermark in Word C++

Watermarks are usually used to show ownership or the nature of the document. You can add/insert or remove watermark in Word Documents (DOC/DOCX) programmatically using C++. For instance, a word document contains classified information and you want to add a watermark in the file then these requirements can be met efficiently with Aspose.Words for C++ API.

Insert or Remove Watermark in Word Files – API Installation

For working with watermarks in word documents, you need to configure Aspose.Words for C++ API by downloading it from the official site, or via the following NuGet command:

Install-Package Aspose.Words.Cpp -Version 20.10.0

After installing it, you will be able to edit and manipulate Microsoft Word Document formats including DOC, DOCX, and other supported file formats.

Add or Insert Text Watermark in Word Document (DOC/DOCX) using C++

You can add or insert watermark text in word documents using C++. Moreover, you can control the formatting of text like font style, size, color, and transparency. You need to follow the steps below for inserting watermark text in Word documents (DOC/DOCX).

  1. Load input document
  2. Initialize TextWatermarkOptions object
  3. Set Font Style, Size, and Color
  4. Set Text as Watermark
  5. Save the output word document

The code snippet below shows how to add or insert text watermark in word documents using C++:

Add or Insert Image Watermark in Word Document (DOC/DOCX) using C++

You can add or insert image watermark in word documents (DOC/DOCX) by your C++ applications. The picture may contain some text or logo with some transparency value. You need to follow the following steps to add an image watermark in a word document:

  1. Load input word document
  2. Initialize an object of ImageWatermarkOptions class
  3. Load watermark image
  4. Save the output word file

The following code is based on these steps which shows how to add or insert image watermark in word documents using C++:

Delete or Remove Watermark from Word Document (DOC/DOCX) using C++

You might need to update a watermark in a word document. In many such related scenarios, you might want to remove or delete a watermark from word document (DOC/DOCX). The API gives you the control to decide if you want to delete a text watermark or image watermark because single word document can contain more than one kind of watermark. Here we will be removing text watermark in a DOCX file with the following steps:

  1. Load input word document
  2. Access watermark of Text type
  3. Remove Text watermark in the document
  4. Save output word document

The code below shows how to delete or remove watermark from DOC/DOCX word document using C++:

Conclusion

We have learned how to add or insert watermark in word documents (DOC/DOCX) programmatically using the C++ language. You can insert text or image watermark as per your requirements. Moreover, you can also remove or delete a watermark from a word document. Both image and text watermarks can be removed using C++. Furthermore, you can explore the API further by referring to Product Documentation, API References, Examples Project, or you can reach us anytime at Free Support Forum for any query.

See Also

Convert Word (DOC/DOCX) to HTML MHTML Programmatically using C++