原创|使用教程|编辑:李显亮|2020-04-22 11:41:17.533|阅读 346 次
概述:很高兴与大家分享Java平台的Aspose.Words迎来了2020.4月更新,该版本具有.NET版同样的7大新升级体验,包括支持OpenGL渲染,日志记录系统已更新和改进,图表数据标签和系列的扩展API等等。本文将用示例为大家解读新功能的用法。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
Aspose.Words for Java是功能丰富的Word处理API,允许开发人员在不使用Microsoft Word的情况下嵌入在自己的Java应用程序中生成,修改,转换,呈现和打印文档的功能。
很高兴与大家分享Java平台的Aspose.Words迎来了2020.4月更新,该版本具有.NET版同样的7大新升级体验,包括Java平台现在支持OpenGL渲染,日志记录系统已更新和改进,图表数据标签和系列的扩展API等等。本文将用示例为大家演示这些新功能,帮助你快速上手。
添加了以下ParagraphFormat属性:
Use positive values to set the first-line indent, and negative values to set the hanging indent.
用例(.NET)
请注意,设置单位的缩进和间距将更新适当的公共缩进或间距属性。例如,设置ParagraphFormat.CharacterUnitLeftIndent将更新ParagraphFormat.LeftIndent。
Document doc = new Document() ParagraphFormat format = doc.FirstSection.Body.FirstParagraph.ParagraphFormat; format.CharacterUnitLeftIndent = 10; // ParagraphFormat.LeftIndent will be updated format.CharacterUnitRightIndent = 10; // ParagraphFormat.RightIndent will be updated format.CharacterUnitFirstLineIndent = 20; // ParagraphFormat.FirstLineIndent will be updated format.LineUnitBefore = 5; // ParagraphFormat.SpaceBefore will be updated format.LineUnitAfter= 10; // ParagraphFormat.SpaceAfter will be updated
添加了新的公共属性SaveOptions.Dml3DEffectsRenderingMode :
用例(.NET)
Document doc = new Document(docPath); SaveOptions saveOptions = new PdfSaveOptions(); saveOptions.Dml3DEffectsRenderingMode = Dml3DEffectsRenderingMode.Advanced; doc.Save(pdfPath, saveOptions);
请注意:为了使“高级”模式正常工作,必须将系统中的比例设置为100%。下表显示了两种模式之间的差异:
添加了以下属性:
用例(.NET)
DocumentBuilder builderA = new DocumentBuilder(new Document());
DocumentBuilder builderB = new DocumentBuilder(new Document());
builderA.Writeln("This is A simple word");
builderB.Writeln("This is B simple words");
CompareOptions co = new CompareOptions();
co.Granularity = Granularity.CharLevel;
builderA.Document.Compare(builderB.Document, "author", DateTime.Now, co);
用于以下属性的设置器已添加到Table类中:
注意,HorizontalAnchor设置器中仅允许使用以下值。对于任何其他值,将引发ArgumentException。
注意,VerticalAnchor设置器中仅允许使用以下值。对于任何其他值,将引发ArgumentException。
用例(.NET)
Document doc = new Documnet(file_with_table); Table table = doc.FirstSection.Body.Tables[0]; table.HorizontalAnchor = RelativeHorizontalPosition.Column; table.VerticalAnchor = RelativeVerticalPosition.Page;
为PDF渲染添加了图像插值选项,可以通过PdfSaveOptions.InterpolateImages属性指定。
用例(.NET)
Document doc = new Document(docPath); PdfSaveOptions saveOptions = new PdfSaveOptions(); saveOptions.InterpolateImages = true; doc.Save(pdfPath, saveOptions);
图表数据标签API中的以下更改已实现(WORDSNET-19124):
public class ChartSeries
{
/// <summary>
/// Gets or sets a flag indicating whether data labels are displayed for the series.
/// </summary>
public bool HasDataLabels { get; set; }
}
public class ChartDataLabelCollection
{
/// <summary>
/// Adds new <see cref="ChartDataLabel"/> at the specified index.
/// </summary>
[Obsolete("When ChartSeries.HasDataLabels is 'true', all data labels are available in this collection.")]
public ChartDataLabel Add(int index);
/// <summary>
/// Clears format of a <see cref="ChartDataLabel"/> at the specified index.
/// </summary>
[Obsolete("Use the ChartDataLabel.ClearFormat method instead.")]
public void RemoveAt(int index);
/// <summary>
/// Clears format of all <see cref="ChartDataLabel"/> in this collection.
/// </summary>
[Obsolete("Use the ClearFormat method instead.")]
public void Clear();
/// <summary>
/// Clears format of all <see cref="ChartDataLabel"/> in this collection.
/// </summary>
public void ClearFormat();
}
public class ChartDataLabel
{
/// <summary>
/// Clears format of this data label. The properties are set to the default values defined in the parent data label collection.
/// </summary>
public void ClearFormat();
/// <summary>
/// Gets/sets a flag indicating whether this label is hidden.
/// The default value is <b>false</b>.
/// </summary>
public bool IsHidden { get; set; }
}
用例(.NET)
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Shape shape = builder.InsertChart(ChartType.Line, 432, 252);
Chart chart = shape.Chart;
// Delete default generated series.
chart.Series.Clear();
ChartSeries series1 = chart.Series.Add("Series 1",
new string[] { "Category 1", "Category 2", "Category 3" },
new double[] { 1, 5, 4 });
series1.HasDataLabels = true;
series1.DataLabels.ShowValue = true;
series1.DataLabels[1].ShowCategoryName = true;
series1.DataLabels[1].ShowValue = true;
series1.DataLabels[2].IsHidden = true;
doc.Save(dir + "DataLabels.docx");
实验表明,“ Tribal *” 边框艺术样式与ISO29500特定边框艺术样式之间存在相互对应关系,范围从 “ Triangle1 ”到“ Shapes2 ”。在此版本中,根据下表实现了所提到的BorderArt样式名称的直接转换:
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@ke049m.cn