Aspose.Words for .NET是用于执行各种文档管理和操作任务,支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。同时支持所有流行的Word处理文件格式,并允许将Word文档导出或转换为固定布局文件格式和最常用的图像、多媒体格式。
Aspose.Words for .Net更新至新版本v19.8,新增分析在docker(Linux)中使用图像转换文档所需的内容功能,以及渲染/转换为PDF时忽略字距调整选项,修复多项Bug,我们一起来看一看新功能详解吧!>>欢迎下载Aspose.Words for .NET v19.8体验
主要特点
- 实现了一个选项,该选项允许指定是否使用文档的原始版本还是修订版。
- 实现API来定义图表系列数据标签的默认选项。
- 固定的对角线边界渲染是垂直合并的单元格。
- 修正了当“keep with next”应用于表格单元格的最后一段时出现的问题。
- 改进了表格中亚洲文本段落度量的计算。
- 改进的代理对处理。
- 修正了负对比度图像渲染的问题。现在,如果文档包含具有负对比度的VML图像,它们将以与MS Word相同的方式呈现,而不会导致异常。
- 修正了渲染DML图表时数据标签和序列值关联不正确的错误。
- 修正了渲染时计算散点图x值的错误。
- 修正了渲染DML图表时继承数据标签(字体大小)段落属性的错误。
- 修正了渲染DML图表时剪切用户形状文本的错误。
公共API更改示例详解
▲实现了一个选项,允许指定是否使用文档的原始版本或修订版本
添加了新的公开枚举:
////// Allows to specify whether to work with the original or revised version of a document. ///public enum RevisionsView
在Document类中添加了新的公共选项:
////// Gets or sets a value indicating whether to work with the original or revised version of a document. ///////// The default value is . ///public RevisionsView RevisionsView
如何访问文档的修订版本:
Document doc = new Document(@"test.docx"); doc.UpdateListLabels(); // Switch to the revised version of the document. doc.RevisionsView = RevisionsView.Final; foreach (Revision revision in doc.Revisions) { if (revision.ParentNode.NodeType == NodeType.Paragraph) { Paragraph paragraph = (Paragraph)revision.ParentNode; if (paragraph.IsListItem) { // Print revised version of LabelString and ListLevel. Console.WriteLine(paragraph.ListLabel.LabelString); Console.WriteLine(paragraph.ListFormat.ListLevel); } } }
▲WORDSNET-18600 - 实现API以定义图表系列数据标签的默认选项
ChartDataLabelCollection类中添加了以下新公共属性:
////// Allows to specify whether category name is to be displayed for the data labels of the entire series. /// Default value is false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowCategoryName { get; set; } ////// Allows to specify whether bubble size is to be displayed for the data labels of the entire series. /// Applies only to Bubble charts. /// Default value is false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowBubbleSize { get; set; } ////// Allows to specify whether legend key is to be displayed for the data labels of the entire series. /// Default value is false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowLegendKey { get; set; } ////// Allows to specify whether percentage value is to be displayed for the data labels of the entire series. /// Default value is false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowPercentage { get; set; } ////// Returns or sets a Boolean to indicate the series name display behavior for the data labels of the entire series. /// True to show the series name. False to hide. By default false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowSeriesName { get; set; } ////// Allows to specify whether values are to be displayed in the data labels of the entire series. /// Default value is false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowValue { get; set; } ////// Allows to specify whether data label leader lines need be shown for the data labels of the entire series. /// Default value is false. /////////Applies to Pie charts only. /// Leader lines create a visual connection between a data label and its corresponding data point.///Value defined for this property can be overridden for an individual data label with using the ///property.///public bool ShowLeaderLines { get; set; } ////// Allows to specify whether values from data labels range to be displayed in the data labels of the entire series. /// Default value is false. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public bool ShowDataLabelsRange { get; set; } ////// Gets or sets string separator used for the data labels of the entire series. /// The default is a comma, except for pie charts showing only category name and percentage, when a line break /// shall be used instead. ///////// Value defined for this property can be overridden for an individual data label with using the ///property. ///public string Separator { get; set; } ////// Gets aninstance allowing to set number format for the data labels of the /// entire series. ///public ChartNumberFormat NumberFormat { get; set; }
使用案例:
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); Shape shape = builder.InsertChart(ChartType.Pie, 432, 252); Chart chart = shape.Chart; chart.Series.Clear(); ChartSeries series = chart.Series.Add("Series 1", new string[] { "Category1", "Category2", "Category3" }, new double[] { 2.7, 3.2, 0.8 }); ChartDataLabelCollection labels = series.DataLabels; labels.ShowPercentage = true; labels.ShowValue = true; labels.ShowLeaderLines = false; labels.Separator = " - "; doc.Save(dir + "Demo.docx");