Add WordArt Watermark to Worksheet
Contents
[
Hide
]
Use WordArt to add special text effects to spreadsheets. For example, stretch a title across the top of the file, decorate text, and make text fit a preset shape, or apply text to an Excel sheet as a background watermark. The WordArt becomes an object that you can move or position in spreadsheets to add decoration.
The following example shows how to add a WordArt shape to set a background watermark for a worksheet.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from aspose.cells import Workbook | |
from aspose.cells.drawing import MsoPresetTextEffect | |
from os import os, path | |
# 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(".") | |
# Create directory if it is not already present. | |
IsExists = path.isdir(dataDir) | |
if notIsExists: | |
os.makedirs(dataDir) | |
# 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) | |
# Get the fill format of the word art | |
wordArtFormat = wordart.fill | |
# Set the transparency | |
wordArtFormat.transparency = 0.9 | |
# Make the line invisible | |
lineFormat = wordart.line | |
dataDir = dataDir + "Watermark_Test.out.xls" | |
# Save the file | |
workbook.save(dataDir) |