网上找了很多,大都是小例子,价值不高。于是去github上搜了下,找到
https://github.com/asposecells/Aspose_Cells_NET
这是官方的示例库,从Readme中,也找到文档地址。
http://www.aspose.com/docs/display/cellsnet/Home
示例和文档基本是对应关系。文档的函数或属性与Excel中的设置窗体一般都是对应的,比如:
每一个属性都与之对应。真的很全面。
摘录几段代码,是我所必须要用到的:
选中文字,以设置样式:
//Setting the font of selected characters to bold
cell.Characters(6, 7).Font.IsBold = true;
//Setting the font color of selected characters to blue
cell.Characters(6, 7).Font.Color = Color.Blue;
显示的换行
//Add Text to the Firts Cell with Explicit Line Breaks
cell[0, 0].PutValue("I am using\nthe latest version of \nAspose.Cells to \ntest this functionality");
//Make Cell's Text wrap
Style style = cell[0, 0].GetStyle();
style.IsTextWrapped = true;
cell[0, 0].SetStyle(style);
自动缩放:
style.ShrinkToFit = true;
上下标:
//Setting subscript effect
style.Font.IsSubscript = true;
//Setting superscript effect
style.Font.IsSuperscript = true;
在Files/Handing/OpeningFiles.cs中,有九个打开文件的示例。就不引用了。