Aspose.Words for Java更新至新版本v21.4,此常规的每月版本中有102个改进和修补程序,包括添加了删除未使用的内置样式的功能、扩展了结构化文档标签范围的公共API等,欢迎下载体验。
随着.NET版Aspose.Words for .Net v21.4的发布,Java版也随之更新,除了一些通用功能外,也独有新改善。
Aspose.Words for Java是一种高级Java Word处理API,使您可以直接在Java应用程序中执行各种文档处理任务,无需Microsoft Word即可生成,修改和转换文档。
主要特点如下:
- 添加了删除未使用的内置样式的功能。
- Fill类扩展了用于处理实体填充的功能。
- 扩展了结构化文档标签范围的公共API。
- Document.getRange().replace()批量修正和改进BUG
- JavaDoc文档更新和错误修复
>>你可以点击这里下载Aspose.Words for Java v21.4测试体验。
新功能解析
①引入了Aspose.Words.Comparing命名空间
由于对Aspose.Words命名空间的重构工作,CompareOptions,ComparisonTargetTargetType,Granularity类被移至新的单独命名空间Aspose.Words.Comparing。如果出现编译错误-请使用Aspose.Words.Comparing添加。
②引入了Aspose.Words.Notes命名空间
由于对Aspose.Words命名空间的重构工作,Footnote,EndnoteOptions,FootnoteOptions,EndnotePosition,FootnotePosition,FootnoteType,FootnoteNumberingRule类已移至新的单独命名空间Aspose.Words.Notes。如果出现编译错误-请使用Aspose.Words.Notes添加。
③WORDSNET-21330/21991:当保存到.NET和.NET Standard上的图像时,支持高级排版
使用GDI +或SkiaSharp保存到图像时(即在所有.NET平台和.NET Standard上),现在支持高级字体。用例:使用高级排版功能将文档保存到图像。
Document doc = new Document("input.docx");doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance;doc.Save("output.png");
④WORDSNET-21808:引入Fill.Solid()方法
将以下新的公共方法添加到Fill类中:

用例:说明如何将填充更改为实体。
// Open some document with text effects.Document doc = new Document("TextTwoColorGradient.docx");// Get Fill object for Font of the first Run.Fill fill = doc.FirstSection.Body.FirstParagraph.Runs[0].Font.Fill;// Check Fill properties of the Font.Console.WriteLine("The type of the fill is: {0}", fill.FillType);Console.WriteLine("The foreground color of the fill is: {0}", fill.ForeColor);Console.WriteLine("The fill is transparent at {0}%", fill.Transparency * 100);// Change type of the fill to Solid with uniform green color.fill.Solid(Color.Green);Console.WriteLine("nThe fill is changed:");Console.WriteLine("The type of the fill is: {0}", fill.FillType);Console.WriteLine("The foreground color of the fill is: {0}", fill.ForeColor);Console.WriteLine("The fill transparency is {0}%", fill.Transparency * 100);doc.Save("TextSolidOut.docx");/*This code example produces the following results:The type of the fill is: GradientThe foreground color of the fill is: Color [A=255, R=0, G=128, B=128]The fill is transparent at 65%The fill is changed:The type of the fill is: SolidThe foreground color of the fill is: Color [A=255, R=0, G=128, B=0]The fill transparency is 0%*/
⑤WORDSNET-21246:扩展了结构化文档标签范围的公共API
StructuredDocumentTagRangeStart和StructuredDocumentTagRangeEnd类的构造函数已公开。现在可以手动创建这些类的实例。

用例:
Document doc = new Document("input.docx");StructuredDocumentTagRangeStart start = new StructuredDocumentTagRangeStart(doc, SdtType.RepeatingSectionItem);StructuredDocumentTagRangeEnd end = new StructuredDocumentTagRangeEnd(doc, start.Id);doc.FirstSection.Body.InsertAfter(start, doc.FirstSection.Body.FirstParagraph);doc.LastSection.Body.InsertBefore(end, doc.LastSection.Body.LastParagraph);doc.Save("output.docx");IEnumerable interface is implemented in StructuredDocumentTagRangeStart class for full LINQ support (i.e. Last(), LastOrDefault() and other methods).Document doc = new Document("input.docx");StructuredDocumentTagRangeStart start = (StructuredDocumentTagRangeStart)doc.FirstSection.Body.GetChild(NodeType.StructuredDocumentTagRangeStart, 0, false);Console.WriteLine(start.LastOrDefault().GetText());
如果你想试用Aspose的全部完整功能,可 联系在线客服获取30天临时授权体验。
还想要更多吗可以点击阅读【2020 · Aspose最新资源整合】,查找需要的教程资源。如果您有任何疑问或需求,请随时加入Aspose技术交流群(),我们很高兴为您提供查询和咨询。
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!