Aspose.Words for Java v19.9新功能:实现建立重复节结构化文档标签能力!

Aspose.Words for Java是功能丰富的Word处理API,容许开发人员在不使用Microsoft Word的状况下嵌入在本身的Java应用程序中生成,修改,转换,呈现和打印文档的功能。同时还提供访问和操做全部文档元素的格式属性,高质量转换为多种格式,将单个页面或完整文档呈现为不一样文件格式,使用来自各类数据源或业务对象的数据生成报告等功能。app

Aspose.Words for Java(点击下载)更新至新版本v19.9,新增基于HarfBuzz整形器的高级排版以及简化Java上的XML数据源使用,添加对Truncate字体高度兼容性选项的支持,修复多项Bug,咱们一块儿来看一看新功能详解吧!字体

主要特色

  • 添加基于HarfBuzz整形器的高级排版
  • 提供了用于编写和修改VBA宏的API
  • 实现了建立重复节结构化文档标签的能力
  • 简化了LINQ Reporting Engine的XML和CSV数据源的工做
  • 改进了“Sitka Banner”、“Sitka Display”、“Sitka Heading”、“Sitka Small”、“Sitka Subheading”、“Sitka Text”和“Cambria Math”字体的渲染
  • 实现OpenType数字间距

新功能示例

▲WORDSNET-12655 - 实现了建立重复节结构化文档标签的能力ui

新版本能够建立重复节的结构化文档标记节点和重复节项类型。新项目也已添加到SdtType枚举类型中:spa

public enum SdtType
{
…
    ////// The SDT represents repeating section item.
    ///////// This is MS-specific feature available since Office 2013 and not supported by the ISO/IEC 29500 OOXML standard.
    ///RepeatingSectionItem,
…
}

用例建立映射到自定义XML部分的表重复节:xml

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
  
CustomXmlPart xmlPart = doc.CustomXmlParts.Add("Books",
    "Everyday ItalianGiada De Laurentiis" +
    "Harry PotterJ K. Rowling" +
    "Learning XMLErik T. Ray");
  
Table table = builder.StartTable();
  
builder.InsertCell();
builder.Write("Title");
  
builder.InsertCell();
builder.Write("Author");
  
builder.EndRow();
builder.EndTable();
  
StructuredDocumentTag repeatingSectionSdt =
    new StructuredDocumentTag(doc, SdtType.RepeatingSection, MarkupLevel.Row);
repeatingSectionSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book", "");
table.AppendChild(repeatingSectionSdt);
  
StructuredDocumentTag repeatingSectionItemSdt =
    new StructuredDocumentTag(doc, SdtType.RepeatingSectionItem, MarkupLevel.Row);
repeatingSectionSdt.AppendChild(repeatingSectionItemSdt);
  
Row row = new Row(doc);
repeatingSectionItemSdt.AppendChild(row);
  
StructuredDocumentTag titleSdt =
    new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Cell);
titleSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book[1]/title[1]", "");
row.AppendChild(titleSdt);
  
StructuredDocumentTag authorSdt =
    new StructuredDocumentTag(doc, SdtType.PlainText, MarkupLevel.Cell);
authorSdt.XmlMapping.SetMapping(xmlPart, "/books[1]/book[1]/author[1]", "");
row.AppendChild(authorSdt);
  
doc.Save(dir + "Document.docx");
相关文章
相关标签/搜索