公共 API Aspose.Cells 8.1.0 的变化

添加了 HtmlSaveOptions.ExportHiddenWorksheet 属性

HtmlSaveOptions 类公开了 ExportHiddenWorksheet 属性,可用于指定隐藏工作表是否导出为 HTML 格式。默认值是true。而如果设置为 false,Aspose.Cells 将不会导出隐藏的工作表内容。

添加了 Cell.StringValueWithoutFormat 属性

StringValueWithoutFormat 属性已添加到 Cell 类,以方便开发人员在不应用任何格式的情况下检索单元格值。

下面提供的代码片段演示了 Cell.StringValueWithoutFormat 属性与 cell.DisplayStringValue 的用法,方法是从头开始创建电子表格并将数字格式应用于其中一个单元格。

C#

 //Create an instance of Workbook

Workbook book = new Workbook();

//Access first worksheet

Worksheet sheet = book.Worksheets[0];

//Access A1 cell

Cell cell = sheet.Cells["A1"];

//Put a value cell and convert it to number

cell.PutValue("123456", true);

//Create a new Style object and add it to Workbook's Style Collection

Style style = book.Styles[book.Styles.Add()];

//Set Number format for Style object

style.Number = 3;

//Set the style of A1 cell

cell.SetStyle(style, new StyleFlag() { NumberFormat = true });

//Get formatted string value 

string formatted = cell.DisplayStringValue;

Console.WriteLine(formatted);

//Get un-formatted string value

string unformatted = cell.StringValueWithoutFormat;

Console.WriteLine(unformatted);

废弃的字节、字符、CharactersWithSpaces、行、段落属性

从 Aspose.Cells for .NET 8.1.0 开始,BuiltInDocumentPropertyCollection 类的许多属性已被标记为过时。这些属性包括字节、字符、带空格的字符、行和段落。原因是,上述属性对 Excel 电子表格的保护没有用,因为 Excel 忽略了它们。这些属性最初是为 Word 文档和 PowerPoint 演示文稿编写的。