How to Add Watermark in Excel using C#

How to Add Watermark in Excel using C#

Load a source XLS/XLSX file, insert a watermark, and protect your visual files from being stolen. In this fast-growing world of data, it is no less than a challenge to keep the business files shielded. However, adding a watermark will prevent your files from losing identity. We will use C# Excel API to automate the process of adding watermarks in Excel files. Therefore, let’s write a code snippet and see how to add watermark in Excel using C# programmatically.

The following points shall be covered in this guide:

C# Excel API installation

This library offers a wide range of methods that help you configure your API calls as per your business requirements. However, to install this API, you can either download the API package or install it via NuGet.

 Install-Package Aspose.Cells

How to Add Watermark in Excel using C#

In many cases, you need to share your WIP(work in progress) files. So, it is mandatory to add a watermark such as your company logo to mark them as your property.

You may follow the steps and the code snippet below:

  1. Instantiate a new instance of the Workbook class.
  2. Get the first default worksheet.
  3. Add Watermark by invoking the AddTextEffect method, set the text effect type of WordArt by passing the TextEffect1 property, WordArt text, Font name, size, bold and fontItalic properties.
  4. Save the file by invoking the Save method.

Copy & paste the following code into your main file:

You may see the output in the image below:

excel watermark

Excel Watermark - advanced options

In addition, there are many methods and properties exposed by this C# Excel API. You may navigate the documentation to know the other features.

Further, you may find the code snippets to add watermarks in the XLSB and XLSM files using this library.

Copy & paste the following code into your main file:

Get a Free License

You can avail a free temporary license to try the API without evaluation limitations.

Summing up

We hope you found this blog post useful. We have gone through that how to add watermark in Excel using C# Excel API. Further, we also explored the advanced options and methods exposed by this library. Do not forget to visit the documentation.

Moreover, we suggest you follow our Getting Started guide.

Finally, is consistently writing new blog posts. Therefore, please stay in touch for the latest updates.

Ask a question

You can let us know about your questions or queries on our forum.


How do I add a watermark to Excel?

Install this C# Excel API to add watermarks in Excel files programmatically, Moreover, you can visit this link to find the steps and the code snippet.

See Also