Ajouter un filigrane WordArt à la feuille de calcul

Ajout d’un filigrane WordArt à la feuille de calcul

L’exemple suivant montre comment ajouter une forme WordArt pour définir un filigrane en arrière-plan pour une feuille de calcul.

Après l’exécution du code, le fichier de sortie contient un filigrane WordArt rouge pâle.

Le fichier de sortie

todo:image_alt_text

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java
// The path to the documents directory.
String dataDir = Utils.getSharedDataDir(AddWordArtWatermarkToWorksheet.class) + "articles/";
// Instantiate a new Workbook
Workbook workbook = new Workbook();
// Get the first default sheet
Worksheet sheet = workbook.getWorksheets().get(0);
// Add Watermark
Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1, "CONFIDENTIAL",
"Arial Black", 50, false, true, 18, 8, 1, 1, 130, 800);
// Get the fill format of the word art
FillFormat wordArtFormat = wordart.getFill();
// Set the color
wordArtFormat.setOneColorGradient(Color.getRed(), 0.2, GradientStyleType.HORIZONTAL, 2);
// Set the transparency
wordArtFormat.setTransparency(0.9);
// Make the line invisible
LineFormat lineFormat = wordart.getLine();
lineFormat.setWeight(0.0);
// Save the file
workbook.save(dataDir + "AWArtWToWorksheet_out.xls");

Sujets avancés