Aggiungi filigrana WordArt al foglio di lavoro
Contents
[
Hide
]
Usa WordArt per aggiungere effetti di testo speciali ai fogli di calcolo. Ad esempio, allunga un titolo lungo la parte superiore del file, decora il testo e adatta il testo a una forma preimpostata oppure applica il testo a un foglio Excel come filigrana di sfondo. La WordArt diventa un oggetto che puoi spostare o posizionare nei fogli di calcolo per aggiungere decorazioni.
Aggiunta di filigrana WordArt al foglio di lavoro
L’esempio seguente mostra come aggiungere una forma WordArt per impostare una filigrana di sfondo per un foglio di lavoro.
Dopo aver eseguito il codice, il file di output contiene una filigrana WordArt rosso pallido.
Il file di output
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
// 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"); |