PPTX DOCX XLSX PDF ODP
  Product Family
DOC

Add Text Watermark to DOC via C#

Build your own .NET apps to watermark DOC files using server-side APIs.

How to Watermark DOC File Using C#

In order to watermark DOC file, we’ll use

Aspose.Words for .NET

API which is a feature-rich, powerful and easy to use document manipulation API for C# platform. Open

NuGet

package manager, search for Aspose.Words and install. You may also use the following command from the Package Manager Console.

Command


PM> Install-Package Aspose.Words

Steps to Add Watermark to DOC via C#

Developers can easily watermark Microsoft Word DOC files by executing the following workflow.

  • Load DOC files with an instance of Document
  • Create an instance of TextWatermarkOptions and set its properties
  • Call Watermark.SetText method and pass watermark text & object of TextWatermarkOptions
  • Save the document in any desierd format

System Requirements

Before integrating code, make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms.
  • Development environment like Microsoft Visual Studio.
  • Aspose.Words for .NET referenced in your project.
 

Add Watermark to DOC - C#


// load DOC in an instance of Document
var document = new Document("template.doc");

// create an instance of TextWatermarkOptions and set its properties
var options = new TextWatermarkOptions()
{
    FontFamily = "Arial",
    FontSize = 36,
    Color = System.Drawing.Color.Black,
    Layout = WatermarkLayout.Horizontal,
    IsSemitrasparent = false
};
// set watermark text with the object of TextWatermarkOptions
document.Watermark.SetText("CONFIDENTIAL", options);  
 
  • .NET Words API can be used to load, view and convert Microsoft Word and OpenDocument Formats like DOC, DOCX, ODT to PDF, XPS, HTML and various other formats. You can also create new documents from scratch and save them in the supported formats. It is a standalone API that is suitable for server side and backend systems where high performance is required. It does not depend on any software like Microsoft or OpenOffice. ‎

    Watermark DOC via Online App

    Other Supported Watermarking Formats

    Using C#, one can easily watermark different formats including.

    DOCX (Office 2007+ Words Document)
    DOT (Microsoft Word Template Files)
    DOTX (Microsoft Word Template File)
    ODT (OpenDocument Text File Format)
    OTT (OpenDocument Standard Format)
    RTF (Rich Text Format)