.NET版文档管理利器Aspose.Words v20.7发布!可处理多节结构化文档标签

原创|产品更新|编辑:李显亮|2020-07-06 11:34:12.450|阅读 41 次

概述:Aspose.Words for .Net更新至新版本v20.7,添加了新节点以处理多节结构化文档标签,改进了SmartArt冷渲染的性能,RevisionOptions类扩展了新的属性,欢迎下载体验。

# 购买正版开发软件送开发入门教材和电子资料,点击进入了解详情 #

七月已至,.NET版Aspose.Words也为大家带来了7月的新版本!Aspose.Words for .Net是一种高级Word文档处理API,用于执行各种文档管理和操作任务。API支持生成,修改,转换,呈现和打印文档,而无需在跨平台应用程序中直接使用Microsoft Word。

主要特点如下:

  • 添加了新节点以处理多节结构化文档标签。
  • 添加了一个新的公共属性MailMerge.RetainFirstSectionStart。
  • RevisionOptions类扩展了新的属性。
  • 改进了SmartArt冷渲染的性能。

>>你可以点击这里下载Aspose.Words for .NET v20.7测试体验

具体更新内容

key 概述 类别
WORDSNET-9500 国际字符(泰米尔语)不能正确地从MHTML转换为PDF 新功能
WORDSNET-7150 SDT控件在打开/保存过程中丢失 新功能
WORDSNET-9501 国际字符(泰卢固语)未正确从MHTML转换为PDF 新功能
WORDSNET-5713 包含分节符的StructuredDocumentTag在加载时丢失 新功能
WORDSNET-20589 PDF到DOCX-脚注 新功能
WORDSNET-20480 提供属性以在邮件合并期间启用“严格MS Word行为合规性” 新功能
WORDSNET-9908 通过分节符保留RichText内容控件 新功能
WORDSNET-6773 设置AllowBreakAcrossPages = False时截断大于页面大小的行内容 增强功能
WORDSNET-20415 通过轨道更改将DOCX转换为PDF时保持修订条 增强功能
WORDSNET-18609 一行移至PDF的上一页 增强功能
完整更新细则请参考:【Aspose.Words for .NET v20.7更新说明】

公共API更改

①添加了新的公共属性MailMerge.RetainFirstSectionStart

/// <summary>
/// Gets or sets a value indicating whether the <see cref="PageSetup.SectionStart"/> of the first document section and its copies for subsequent data source rows
/// are retained during mail merge or updated according to MS Word behaviour.
/// </summary>
/// <remarks>
/// The default value is <b>true</b>.
/// </remarks>
public bool RetainFirstSectionStart { get; set; }

用例:

Document document = new Document(path);
document.MailMerge.RetainFirstSectionStart = false;
document.MailMerge.Execute(dataSource);

②在RevisionOptions中添加了公共属性MeasurementUnit


/// <summary>
/// Allows to specify the measurement unit for revision comments.
/// Default value for this property is <see cref="MeasurementUnits.Centimeters"/>
/// </summary>
public MeasurementUnits MeasurementUnit

另外,添加了新的公共枚举:

/// <summary>
/// Specifies a the unit of measurement.
/// </summary>
public enum MeasurementUnits
{
    /// <summary>
        /// Inches.
        /// </summary>
        Inches = 0,
  
        /// <summary>
        /// Centimeters.
        /// </summary>
        Centimeters = 1,
  
        /// <summary>
        /// Millimeters.
        /// </summary>
        Millimeters = 2,
  
        /// <summary>
        /// Points.
        /// </summary>
        Points = 3,
  
        /// <summary>
        /// Picas (commonly used in traditional typewriter font spacing).
        /// </summary>
    Picas = 4
}


用例:

Document doc = new Document(myDir +"Input.docx");
  
doc.LayoutOptions.RevisionOptions.MeasurementUnit = MeasurementUnits.Inches;
doc.LayoutOptions.RevisionOptions.ShowInBalloons = ShowInBalloons.FormatAndDelete;
doc.LayoutOptions.ShowComments = true;
  
doc.Save(myDir +"Output.pdf");

③在RevisionOptions中添加了公共属性RevisionBarsPosition

/// <summary>
/// Gets or sets rendering position of revision bars.
/// Default value is <see cref="HorizontalAlignment.Outside"/>.
/// </summary>
/// <remarks>Values of <see cref="HorizontalAlignment.Center"/> and <see cref="HorizontalAlignment.Inside"/>
/// are not allowed and will cause <see cref="ArgumentOutOfRangeException"/>.</remarks>

用例:

Document doc = new Document(myDir +"Input.docx");
  
//Renders revision bars on the right side of a page.
doc.LayoutOptions.RevisionOptions.RevisionBarsPosition = HorizontalAlignment.Right;
doc.Save(myDir +"Output.pdf");

④添加了两个新节点来处理多节的结构化文档标签

public class StructuredDocumentTagRangeStart : Node
{
    /// <summary>
    /// Gets the type of this node.
    /// </summary>
    public NodeType NodeType { get; }
  
    /// <summary>
    /// Gets the level at which this <b>SDT range start</b> occurs in the document tree.
    /// </summary>
    public MarkupLevel Level { get; }
  
    /// <summary>
    /// Gets type of this <b>Structured document tag</b>.
    /// </summary>
    public SdtType SdtType { get; }
  
    /// <summary>
    /// <para>Specifies a unique read-only persistent numerical Id for this <b>SDT</b>.</para>
    /// </summary>
    public int Id { get; }
  
    /// <summary>
    /// When set to true, this property will prohibit a user from deleting this <b>SDT</b>.
    /// </summary>
    public bool LockContentControl { get; }
  
    /// <summary>
    /// When set to true, this property will prohibit a user from editing the contents of this <b>SDT</b>.
    /// </summary>
    public bool LockContents { get; }
  
    /// <summary>
    /// Specifies whether the content of this <b>SDT</b> shall be interpreted to contain placeholder text
    /// (as opposed to regular text contents within the SDT).
    /// </summary>
    public bool IsShowingPlaceholderText { get; }
  
    /// <summary>
    /// Specifies a tag associated with the current SDT node.
    /// </summary>
    public string Tag { get; }
  
    /// <summary>
    /// Specifies the friendly name associated with this <b>SDT</b>.
    /// </summary>
    public string Title { get; }
  
    /// <summary>
    /// Specifies end of range if the StructuredDocumentTag is a ranged structured document tag.
    /// </summary>
    public StructuredDocumentTagRangeEnd RangeEnd { get; }
}
  
public class StructuredDocumentTagRangeEnd : Node
{
    /// <summary>
    /// Gets the type of this node.
    /// </summary>
    public NodeType NodeType { get; }
  
    /// <summary>
    /// Specifies a unique read-only persistent numerical Id for this structured document tag node.
    /// Corresponding range start node has the same Id.
    /// </summary>
    public int Id { get; }
}

用例:

Document doc = new Document("document containing multi-section SDT");
Listtags =
                doc.GetChildNodes(NodeType.StructuredDocumentTagRangeStart, true).ToList();
  
foreach(StructuredDocumentTagRangeStart tag in tags)
    Console.WriteLine(tag.Title);

Aspose是目前国内外非常火爆且功能强大的文件格式敏捷开发控件,但因为产品众多、技术问题复杂等因素,也常常遭受开发人员吐槽。如果您也正在使用Aspose相关产品,点击下方按钮,来谈谈Aspose的优劣,您的感受对我们相当宝贵哦~

一起聊聊Aspose的感受吧



标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,尊重他人劳动成果

登录 慧都网发表评论


暂无评论...

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
title
相关厂商
相关产品
Aspose.Words for .NET

无需Microsoft Word也可在任何平台上满足Word文档的一切操作需求。

在线
客服
咨询
电话
400-700-1020
在线
QQ
购物车 反馈 返回
顶部
在线客服系统
live chat