Aggiungi filigrana WordArt al grafico
Contents
[
Hide
]
Puoi utilizzare WordArt per aggiungere effetti di testo speciali ai fogli di calcolo. Ad esempio, allungare un titolo, decorare il testo, adattare il testo a una forma preimpostata o applicare il testo interessato all’area del tracciato di un grafico come filigrana. La WordArt diventa un oggetto che puoi spostare o posizionare nei tuoi fogli di calcolo per aggiungere decorazioni.
Nell’esempio seguente viene illustrato come aggiungere una forma WordArt come filigrana per l’area del tracciato del grafico.
Aggiunta di filigrana WordArt al grafico
Nell’esempio seguente viene illustrato come aggiungere una forma WordArt come filigrana per l’area del tracciato di un grafico esistente. L’esempio utilizza un file Excel modello che contiene già il grafico.
Immagini di confronto prima e dopo l’esecuzione del codice
Il file di input
Il file di output
Java codice per aggiungere WordArt Watermark ai grafici
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(AddWordArtWatermarkToChart.class) + "articles/"; | |
// Instantiate a new workbook, Open the existing excel file. | |
Workbook workbook = new Workbook(dataDir + "sample.xlsx"); | |
// Get the chart in the first worksheet. | |
Chart chart = workbook.getWorksheets().get(0).getCharts().get(0); | |
// Add a WordArt watermark (shape) to the chart's plot area. | |
Shape wordart = chart.getShapes().addTextEffectInChart(MsoPresetTextEffect.TEXT_EFFECT_1, "CONFIDENTIAL", | |
"Arial Black", 66, false, false, 1200, 500, 2000, 3000); | |
// Get the shape's fill format. | |
FillFormat wordArtFormat = wordart.getFill(); | |
// Set the transparency. | |
wordArtFormat.setTransparency(0.9); | |
// Get the line format. | |
LineFormat lineFormat = wordart.getLine(); | |
// Set Line format to invisible. | |
lineFormat.setWeight(0.0); | |
// Save the excel file. | |
workbook.save(dataDir + "AWArtWToC_out.xlsx"); |