Aspose.Cells - Add Word Art Watermark to Chart

//Instantiate a new workbook.
//Open the existing excel file.
Workbook workbook = new Workbook(dataPath + "AsposeChart.xls");

//Get the chart in the first worksheet.
com.aspose.cells.Chart chart = workbook.getWorksheets().get(0).getCharts().get(0);

//Add a WordArt watermark (shape) to the chart's plot area.
com.aspose.cells.Shape wordart = chart.getShapes().addTextEffectInChart(MsoPresetTextEffect.TEXT_EFFECT_2,
"CONFIDENTIAL", "Arial Black", 66, false, false, 1200, 500, 2000, 3000);

//Get the shape's fill format.
com.aspose.cells.MsoFillFormat wordArtFormat = wordart.getFillFormat();

//Set the transparency.
wordArtFormat.setTransparency(0.9);

//Get the line format and make it invisible.
com.aspose.cells.MsoLineFormat lineFormat = wordart.getLineFormat();
lineFormat.setVisible(false);

//Save the excel file.
workbook.save(dataPath + "AsposeChartWatermarked_Out.xls", SaveFormat.EXCEL_97_TO_2003);


Download Source Code

For More Examples, visit Aspose Docs

Last edited Nov 11, 2014 at 3:11 PM by shoaibkhan, version 1