将艺术字水印添加到图表
Contents
[
Hide
]
Aspose.Cells - 为图表添加艺术字水印
您可以使用艺术字向电子表格添加特殊文本效果。例如,拉伸标题、装饰文本、使文本适合预设形状,或将受影响的文本作为水印应用到图表的绘图区域。艺术字成为一个对象,您可以在电子表格中移动或放置它以添加装饰。
Java
//Instantiate a new workbook.
//Open the existing excel file.
Workbook workbook = new Workbook(dataDir + "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.
FillFormat wordArtFormat = wordart.getFill();
//Set the transparency.
wordArtFormat.setTransparency(0.9);
//Make the line invisible.
wordart.setHasLine(false);
//Save the excel file.
workbook.save(dataDir + "AsposeChartWatermarked_Out.xls", SaveFormat.EXCEL_97_TO_2003);
下载运行代码
下载示例代码
欲了解更多详情,请访问将艺术字水印添加到图表.