PPTX DOCX XLSX PDF ODP
Aspose.Words  for C++
ODT

Add Text Watermark to ODT via C++

Build your own C++ apps to watermark ODT files using server-side APIs.

How to Watermark ODT File Using C++

In order to watermark ODT file, we’ll use

Aspose.Words for C++

API which is a feature-rich, powerful and easy to use document watermarking API for C++ platform. You can download its latest version directly, just open

NuGet

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

Command


PM> Install-Package Aspose.Words.Cpp

Steps to Add Watermark to ODT via C++

You need the

aspose.words.dll

to try the following workflow in your own environment.

  1. Load ODT files with an instance of Document
  2. Set different properties for text watermark
  3. Call SetText method and pass watermark text & object of TextWatermarkOptions
  4. Save the document

System Requirements

Aspose.Words for C++ supports on all major platforms and Operating Systems. Please make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with C++ Runtime Environment for Windows 32 bit, Windows 64 bit and Linux 64 bit.
  • Aspose.Words for C++ DLL referenced in your project.
 

Add Watermark to ODT - C++


// Load input odt document
auto odt = System::MakeObject<Document>(inputDataDir + u"Document.odt");

// Set different properties for text watermark
auto options = System::MakeObject<TextWatermarkOptions>();
options->set_FontFamily(u"Arial");
options->set_FontSize(36);
options->set_Color(System::Drawing::Color::get_Black());
options->set_Layout(WatermarkLayout::Horizontal);
options->set_IsSemitrasparent(false);

// Set text for the watermark
odt->get_Watermark()->SetText(u"Test", options);

auto outputPath = outputDataDir + u"AddTextWatermark.odt";

odt->Save(outputPath);  
 
  • About Aspose.Words for C++ API

    Aspose.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. Aspose.Words 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 ODT via Online App

    Other Supported Watermarking Formats

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

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