Locking WordArt Watermark

Contents
[ ]

Aspose.Cells for Python via .NET APIs allow locking certain aspects of the watermark so that the user interaction could be limited or completely blocked. The following code snippet demonstrates the usage of Aspose.Cells for Python via .NET API to lock selection, movement, editing, and re-sizing of the watermark by creating a spreadsheet from scratch.

from aspose.cells import Workbook
from aspose.cells.drawing import GradientStyleType, MsoPresetTextEffect, ShapeLockType
from aspose.pydrawing import Color
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# The path to the documents directory.
dataDir = RunExamples.GetDataDir(".")
# Instantiate a new Workbook
workbook = Workbook()
# Get the first default sheet
sheet = workbook.worksheets[0]
# Add Watermark
wordart = sheet.shapes.add_text_effect(MsoPresetTextEffect.TEXT_EFFECT1, "CONFIDENTIAL", "Arial Black", 50, False, true
, 18, 8, 1, 1, 130, 800)
# Lock Shape Aspects
wordart.is_locked = True
wordart.set_locked_property(ShapeLockType.SELECTION, True)
wordart.set_locked_property(ShapeLockType.SHAPE_TYPE, True)
wordart.set_locked_property(ShapeLockType.MOVE, True)
wordart.set_locked_property(ShapeLockType.RESIZE, True)
wordart.set_locked_property(ShapeLockType.TEXT, True)
# Get the fill format of the word art
wordArtFormat = wordart.fill
# Set the color
wordArtFormat.set_one_color_gradient(Color.red, 0.2, GradientStyleType.HORIZONTAL, 2)
# Set the transparency
wordArtFormat.transparency = 0.9
# Make the line invisible
wordart.has_line = False
# Save the file
workbook.save(dataDir + "output_out.xlsx")