公共 API Aspose.Cells 8.9.0 的变化

添加的 API

添加了 HtmlSaveOptions.DefaultFontName 属性

Aspose.Cells for .NET 8.9.0 公开了 HtmlSaveOptions 类的 DefaultFontName 属性,允许在将电子表格呈现为 HTML 格式时指定默认字体名称。只有当样式字体不存在时,才会使用默认字体。 HtmlSaveOptions.DefaultFontName 属性的默认值为 null,即 Aspose.Cells for .NET API 将使用与原始字体同族的通用字体。

以下是简单的使用场景。

C#

 // Create an instance of HtmlSaveOptions

var options = new HtmlSaveOptions();

// Set default font name for Html rendering

options.DefaultFontName = "Arial";

// Load a spreadsheet in an instance of Workbook

var book = new Workbook(dir + "sample.xlsx");

// Save the spreadsheet in Html format while passing instance of HtmlSaveOptions

book.Save(dir + "output.html", options);

添加了 ImageOrPrintOptions.DefaultFont 属性

Aspose.Cells for .NET 8.9.0 允许通过公开 DefaultFont 属性为 ImageOrPrintOptions 类设置默认字体名称。当电子表格中的 Unicode 字符未在单元格样式中设置正确的字体时,可以使用上述属性,因此此类字符可能在结果图像中显示为块。

以下是简单的使用场景。

C#

 // Create an instance of ImageOrPrintOptions

var options = new ImageOrPrintOptions();

// Set default font name for image rendering

options.DefaultFont = "Arial";

// Load a spreadsheet in an instance of Workbook

var book = new Workbook(dir + "sample.xlsx");

// Access the worksheet to be rendered

var sheet = book.Worksheets[0];

// Create an instance of SheetRender

var render = new SheetRender(sheet, options);

// Save spreadsheet to image

render.ToImage(0, dir + "output.png");

添加了 PivotTable.IsExcel2003Compatible 属性

Aspose.Cells for .NET API 公开了数据透视表类的布尔类型 IsExcel2003Compatible 属性,它允许指定数据透视表是否与 Excel 2003 兼容以用于刷新目的。 IsExcel2003Compatible 属性的默认值为 true,这意味着字符串必须小于或等于 255 个字符。如果字符串大于 255 个字符,它将被截断。如为虚假,则不会受到上述限制。

以下是简单的使用场景。

C#

 // Load a spreadsheet in an instance of Workbook

var book = new Workbook(dir + "sample.xlsx");

// Access the desired Pivot Table from the spreadsheet

var pivot = book.Worksheets[0].PivotTables[0];

// Set Excel 2003 compatibility to false

pivot.IsExcel2003Compatible = false;

// Refresh & recalculate Pivot Table

pivot.RefreshData();

pivot.CalculateData();

添加了 GridWeb.GetVersion 方法

Aspose.Cells.GridWeb for .NET 8.9.0 公开了 {GetVersion}} 工厂方法,该方法返回 GridWeb 组件的发布版本。