Aspose.Cells如何控制Excel中图形的文本内容的外观

作者:控件中国网   出处:控件中国网   2016-09-26 10:23:22   阅读:7

Aspose.Cells是一款被全球广大开发人员使用的Excel电子数据表格处理类控件,不仅可以实现Excel文件的各种操作和转换,还可以像Excel软件一样进行各式各样的单元格、工作表编辑、计算和格式化,在新的9.0版本中开发人员可以利用新的Shape.TextOptions属性来完全控制Excel文档中图形对象文本内容的外观和样式了,下面以.NET为例:
 
/ Initialize an instance of Workbook
var book = new Workbook();
// Get the default Worksheet from the Workbook
var sheet = book.Worksheets[0];
// Add a TextBox to the collection
var textboxIndex = sheet.TextBoxes.Add(2, 1, 160, 200);
// Get the TextBox object
var textbox = sheet.TextBoxes[textboxIndex];
// Add text to the TextBox
textbox.Text = "Hello Aspose!";
// Format the textual contents
textbox.TextOptions.Color = System.Drawing.Color.Red;
textbox.TextOptions.IsItalic = true;
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat