Aspose.Cells电子数据表格控件发布了新的8.6.1版本

作者:控件中国网   出处:控件中国网   2015-11-19 10:45:05   阅读:42

Aspose公司对旗下产品Aspose.Cells For .NET发布了新的8.6.1版本,这篇文章主要介绍Aspose.Cells 8.6.1和8.6.0在控件提供的API上有什么新的变化,在新的8.6.1版本中不仅包含了新的方法和添加类,还描述了很多功能上的增强,具体可以参考下面的介绍:
Aspose.Cells在8.6.1中支持 HTML链接类型, HtmlLinkTargetType枚举类型如下:
  • HtmlLinkTargetType.Blank: 在新的窗口或者标签里打开新的文档
  • HtmlLinkTargetType.Parent: 在父窗口中打开新的文档
  • HtmlLinkTargetType.Self: 在自身窗口打开新的页或文档.
  • HtmlLinkTargetType.Top:全屏打开链接的文档或页
具体用法:
//Load a Spreadsheet
Workbook workbook = new Workbook(inputFilePath);
//Create an instance of HtmlSaveOptions
HtmlSaveOptions options = new HtmlSaveOptions();
//Set the LinkTargetType property to appropriate value
options.LinkTargetType = HtmlLinkTargetType.Blank;
//Convert the Spreadsheet to HTML with preset HtmlSaveOptions
workbook.Save(outputFilePath, options);
 
新增VbaModuleCollection.Remove方法,该方法用于删除指定工作表的宏模块,具体用法如下:
//Load a Spreadsheet
Workbook workbook = new Workbook(inputFilePath);
//Retrieve the VBA modules from the Workbook
VbaModuleCollection modules = workbook.VbaProject.Modules;
//Remove the VBA modules from specific Worksheet
modules.Remove(workbook.Worksheets[0]);
 
Aspose.Cells 8.6.1版本新增了RangeCollection.Add方法,该方法用于添加新的Range到Range集合,具体用法如下:
//Load a Spreadsheet
Workbook workbook = new Workbook(inputFilePath);
//Retrieve the Cells of the first worksheet in the workbook
Cells cells = workbook.Worksheets[0].Cells;
//Retrieve the range collection from first worksheet of the Workbook
RangeCollection ranges = cells.Ranges;
//Add another range to the collection
ranges.Add(cells.CreateRange("A1:B4"));
 
新增了Cell.SetCharacters方法,该方法用于设置Excel单元格内部分文本或者全部文本的字体、样式、颜色等,具体用法如下:
//Load a Spreadsheet
Workbook workbook = new Workbook(inputFilePath);
//Access first worksheet of the workbook
Worksheet worksheet = workbook.Worksheets[0];
//Access the cells containing the Rich Text
Cell cell = worksheet.Cells["A1"];
//Retrieve the array of FontSetting from the cell
FontSetting[] settings = cell.GetCharacters();
//Modify the Font Name for the first FontSetting 
settings[0].Font.Name = "Arial";
//Set the updated FontSetting
cell.SetCharacters(settings);
 
新增了VbaProject.IsSigned方法,Aspose.Cells提供的该方法用于检测Excel文件里嵌入的VBA项目是否签名,具体用法如下:
//Load a Spreadsheet
Workbook workbook = new Workbook(inputFilePath);
//Retrieve the VbaProject from the Workbook
VbaProject project = workbook.VbaProject;
//Test if VbaProject is signed
if (project.IsSigned)
{
    Console.WriteLine("VBA Project is Signed");
}
else
{
    Console.WriteLine("VBA Project is not Signed");
}
  • 修改了Cell.GetFormatConditions方法的返回值类型,在8.6.1版本后该方法返回一个FormatConditionCollection数组类型
  • Workbook.CheckWriteProtectedPassword方法在8.6.1种标记为即将作废,建议使用新的WorkbookSettings.WriteProtection.ValidatePassword方法
 
Copyright© 2006-2015 ComponentCN.com all rights reserved.重庆磐岩科技有限公司(控件中国网) 版权所有 渝ICP备12000264号 法律顾问:元炳律师事务所
客服软件
live chat