Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Section
Column
width50%
Panel
titleBGColor#B0C4DE
titleContents Summary
Table of Contents
stylenone
outlinetrue
typelist
Info

The code samples in this article use some of the methods defined in Working with Common Utilities.

In the previous section, we described three kinds of watermark that can be added to an Excel document using GroupDocs.Watermark API:

...

Here we will focus on how to work with existing objects of all these types.

Removing Watermark from a Particular Worksheet

Removing watermark from a particular Excel worksheet using GroupDocs.Watermark consists of following steps.

  1. Load the document
  2. Create and initialize image/text search criteria
  3. Find possible watermarks
  4. Remove found watermarks
  5. Save the document

Following code sample shows how to remove watermark from a particular worksheet.

 

HTML
<script src="https://gist.github.com/GroupDocsGists/95fbe192d18fe235f626709146a924c1.js"></script>

Working with Shapes

Extracting Information about all Shapes in an Excel Document

FindWatermarks method searches watermarks of all mentioned types, but in some cases, it's necessary to analyze only one class of Excel objects. Following code sample shows how to get information about all the shapes in an Excel document.

HTML
 <script src="https://gist.github.com/GroupDocsGists/74ed9bcf76d5386bb86f30d404903391.js"></script>

Removing a Particular Shape

You can also remove a particular shape from the worksheet as shown in the below code sample.

HTML
 <script src="https://gist.github.com/GroupDocsGists/ca259416dc93dff27cc556d0f8e3dbb2.js"></script>

Adding Watermark to all Image Shapes in an Excel Worksheet

Using GroupDocs.Watermark, you can add watermark to the image shapes that belong to an Excel worksheet as shown in the below code sample.

HTML
 <script src="https://gist.github.com/GroupDocsGists/75edaf99350d5a96f53828b710b388c2.js"></script>

Removing Shapes with Particular Text Formatting

You can also find and remove the shapes with a particular text formatting from an Excel document as shown in the below code sample.

 

HTML
<script src="https://gist.github.com/GroupDocsGists/de110831d1ac7c110fcca9e4220edd20.js"></script>

Removing/Replacing Hyperlink Associated with a Particular Shape

Using GroupDocs.Watermark for .NET, you can also remove/replace hyperlink associated with a particular shape or chart inside an Excel document. Use following code sample to achieve this functionality.

 

HTML
<script src="https://gist.github.com/GroupDocsGists/585a04aeea0956c33f6a01eaddfc565e.js"></script>
Note

This feature is also supported for charts.

Replacing Text for Particular Shapes

Since version 17.12, GroupDocs.Watermark supports replacing text for particular shapes in an Excel Worksheet. Following code sample shows the usage of this feature. 

 

HTML
<script src="https://gist.github.com/GroupDocsGists/fd734770f060a82f23075b3c64e8641d.js"></script>

 

You can also replace the text of the shapes with formatted text as shown in the following code sample.

HTML
<script src="https://gist.github.com/GroupDocsGists/9d6a8671359205929a14408857226742.js"></script>

Replacing Shape Image

GroupDocs.Watermark also allows you to replace the image of the particular shapes in an Excel Worksheet as shown in the following code sample. This feature is supported since version 17.12. 

 

HTML
<script src="https://gist.github.com/GroupDocsGists/091ac7f7da56d755193f9f1b6d678c46.js"></script>

Setting Background Image for Particular Shapes

Since version 17.12, GroupDocs.Watermark enables you to set the background image for the particular shapes in an Excel Worksheet. Following code sample shows the usage of this feature.

 

HTML
<script src="https://gist.github.com/GroupDocsGists/a9a91a4632b7dfa2046aa1cbd98ca14d.js"></script>

Updating Shape Properties

Since version 17.12, GroupDocs.Watermark also provides the feature of modifying properties of particular shapes in an Excel Worksheet. Following code sample shows how to use this feature.

 

HTML
<script src="https://gist.github.com/GroupDocsGists/e84cc3345b9dec12f9ea3d9b9720c373.js"></script>

Working with Backgrounds

Extracting Information about all Worksheet Backgrounds in an Excel Document

The API allows you to extract information about all the worksheet backgrounds in an Excel document as shown in the following code sample. 

HTML
 <script src="https://gist.github.com/GroupDocsGists/4a1a77fef37a5338891f10b7ef550b6e.js"></script>

Removing a Particular Background

Following code sample can be used to remove the background of a particular worksheet.

HTML
 <script src="https://gist.github.com/GroupDocsGists/328e06c3a2e5071da45f19d18d0e172e.js"></script>

Adding Watermark to all Backgrounds in an Excel Worksheet

You can add watermark to the background images that belong to an Excel document as shown in the below code sample.

HTML
 <script src="https://gist.github.com/GroupDocsGists/2dc9e953f8728dbadc36b1b1076ec6b6.js"></script>

Settings Background Image for Charts

Info

This feature is supported in v17.6.0 and greater.

GroupDocs.Watermark for .NET also allows you to set the background image for a chart inside an Excel document. Use following code sample to achieve this functionality.

 

HTML
<script src="https://gist.github.com/GroupDocsGists/4de2d8d7874245f9dae5f95b369f3c58.js"></script>

Working with Headers&Footers

Extracting Information about all Headers&Footers in an Excel Document

You can extract information about all the headers&footers in an Excel document as shown in the below code sample.

HTML
 <script src="https://gist.github.com/GroupDocsGists/e64b7db8112fd59911a88b40003681cf.js"></script>

Clearing a Particular Header&Footer

You can also clear a particular header&footer using GroupDocs.Watermark as shown in the below code sample.

HTML
 <script src="https://gist.github.com/GroupDocsGists/b99dbd403374b7141f864517ad07d7f3.js"></script>

Clearing a Particular Section of Header&Footer

Using GroupDocs.Watermark, you can also clear a particular section of header&footer as shown in the sample code below.

HTML
 <script src="https://gist.github.com/GroupDocsGists/6f70a76d742ad282b75f4ca211d10dcf.js"></script>

Adding Watermark to all Images in Header&Footer

GroupDocs.Watermark enables you to add watermark to images inside any header&footer. You can use below code sample to achieve this.

HTML
 <script src="https://gist.github.com/GroupDocsGists/060bac856788aa36b85a2c50f994f67e.js"></script>

 

 

Page Tree
root@self