使用Aspose.Cells為工作表添加藝術字浮水印

來源:互聯網
上載者:User

可以使用Aspose.Cells為試算表添加特殊的文字效果。例如,可以展開標題,修飾文本,並使文本符合預設形狀,或者是為試算表添加浮水印效果。

在下面的例子中將示範如何使用Aspose.Cells提供的簡單API為工作表添加浮水印效果。

範例程式碼:

C#

 //Instantiate a new WorkbookWorkbook workbook = new Workbook();//Get the first default sheetWorksheet sheet = workbook.Worksheets[0];//Add WatermarkAspose.Cells.Drawing.Shape wordart = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1,"CONFIDENTIAL", "Arial Black", 50, false, true, 18, 8, 1, 1, 130, 800);//Get the fill format of the word artMsoFillFormat wordArtFormat = wordart.FillFormat;//Set the colorwordArtFormat.ForeColor = System.Drawing.Color.Red;//Set the transparencywordArtFormat.Transparency = 0.9;//Make the line invisibleMsoLineFormat lineFormat = wordart.LineFormat;lineFormat.IsVisible = false;//Save the fileworkbook.Save("e:\\test2\\Watermarkt_Test.xls");

[VB]

'Instantiate a new WorkbookDim workbook As New Workbook()'Get the first default sheetDim sheet As Worksheet = workbook.Worksheets(0)'Add WatermarkDim wordart As Aspose.Cells.Drawing.Shape = sheet.Shapes.AddTextEffect(MsoPresetTextEffect.TextEffect1, "CONFIDENTIAL", "Arial Black", 50, False, True, 18, 8, 1, 1, 130, 800)'Get the fill format of the word artDim wordArtFormat As MsoFillFormat = wordart.FillFormat'Set the colorwordArtFormat.ForeColor = System.Drawing.Color.Red'Set the transparencywordArtFormat.Transparency = 0.9'Make the line invisibleDim lineFormat As MsoLineFormat = wordart.LineFormatlineFormat.IsVisible = False'Save the fileworkbook.Save("e:\test2\Watermarkt_Test.xls")

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.