彩票走势图

Aspose.Cells为图表添加艺术字水印

原创|其它|编辑:郝浩|2012-09-04 15:01:33.000|阅读 1027 次

概述:大家都知道,水印是电子表格中比较常见的应用。所以,强大的Aspose.Cells自然也有添加水印的功能啦,那么,这一功能具体是如何实现的呢?

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

大家都知道,水印是电子表格中比较常见的应用。所以,强大的Aspose.Cells自然也有添加水印的功能啦,那么,这一功能具体是如何实现的呢?

下面,就由慧都小编给出一个实例,供大家学习使用:

本例中,我们的目的就是为Excel文件中的一个图表添加艺术字背景水印。

首先,让我们来看一下添加水印前的效果图:

Aspose.Cells为图表添加艺术字水印

接下来,我们输入相应的代码:

[C#]

 //Instantiate a new workbook.
//Open the existing excel file.
Workbook workbook = new Workbook("e:\\test\

\Report_Test1.xls");
//Get the chart in the first worksheet.
Aspose.Cells.Charts.Chart chart = workbook.Worksheets

[0].Charts[0];
//Add a WordArt watermark (shape) to the chart's plot area.
Aspose.Cells.Drawing.Shape wordart =

chart.Shapes.AddTextEffectInChart

(MsoPresetTextEffect.TextEffect2,
"CONFIDENTIAL", "Arial Black", 66, false, false, 1200, 500,

2000, 3000);
//Get the shape's fill format.
Aspose.Cells.Drawing.MsoFillFormat wordArtFormat =

wordart.FillFormat;
//Set the transparency.
wordArtFormat.Transparency = 0.9;
//Get the line format and make it invisible.
Aspose.Cells.Drawing.MsoLineFormat lineFormat =

wordart.LineFormat;
lineFormat.IsVisible = false;
//Save the excel file.
workbook.Save("e:\\test\\outReport_Test1.xls");
 

[VB]

 'Instantiate a new workbook.
'Open the existing excel file.
Dim workbook As New Workbook("e:\test\Report_Test1.xls")
'Get the chart in the first worksheet.
Dim chart As Aspose.Cells.Charts.Chart =

workbook.Worksheets(0).Charts(0)
'Add a WordArt watermark (shape) to the chart's plot area.
Dim wordart As Aspose.Cells.Drawing.Shape =

chart.Shapes.AddTextEffectInChart

(MsoPresetTextEffect.TextEffect2, "CONFIDENTIAL", "Arial

Black", 66, False, False, 1200, 500, 2000, 3000)
'Get the shape's fill format.
Dim wordArtFormat As Aspose.Cells.Drawing.MsoFillFormat =

wordart.FillFormat
'Set the transparency.
wordArtFormat.Transparency = 0.9
'Get the line format and make it invisible.
Dim lineFormat As Aspose.Cells.Drawing.MsoLineFormat =

wordart.LineFormat
lineFormat.IsVisible = False
'Save the excel file.
workbook.Save("e:\test\outReport_Test1.xls")

最后,让我们来看一下代码运行后的效果图吧:

Aspose.Cells为图表添加艺术字水印


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn

文章转载自:本站原创

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP