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:

  • Shapes
  • Backgrounds
  • Headers&Footers

Here we will focus on how to work with shapes.

Working with Shapes

Extracting Information about all Shapes in an Excel Document

The 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/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-GetShapesInformationExcel.java"></script>

Removing a Particular Shape

You can also remove a particular shape from the worksheet using below code sample.

HTML
<script src="https://gist.github.com/GroupDocsGists/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-RemoveShapeExcelWorksheet.java"></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. Following code sample shows how to add watermark to all image shapes.

HTML
<script src="https://gist.github.com/GroupDocsGists/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-AddWatermarkToImagesExcelWorksheet.java"></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/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-RemoveTextShapesWithParticularTextFormattingExcel_1.java"></script>

Removing/Replacing Hyperlink Associated with a Particular Shape

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

HTML
<script src="https://gist.github.com/GroupDocsGists/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-RemoveHyperlinksExcel_1.java"></script>
Note

This feature is also supported for charts.

Replacing Text for Particular Shapes

Replacing Shape's Text

GroupDocs.Watermark also 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/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-ReplaceTextForParticularShapes_17.12.java"></script>

Replacing Shape's Text with Formatted Text

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/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-ReplaceTextWithFormattingForParticularShapes_17.12.java"></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.

HTML
<script src="https://gist.github.com/GroupDocsGists/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-ReplaceImageOfParticularShapes_17.12.java"></script>

Setting Background Image for Particular Shapes

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/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-SetBackgroundImageForParticularShapes.java"></script>

Updating Shape Properties

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/317b2b4e2fa1cf17b7d15a8d43169540.js?file=Documents-UpdateShapeProperties.java"></script>