【更新】Aspose.Words 2月新版v19.2发布 | 附下载

1,010 阅读7分钟

Aspose.Words无需Microsoft Word 也可在任何平台上满足Word文档的一切操作需求。2019年2月Aspose.Words发布v19.2,以下是v19.2更新说明:

                                      【Aspose.Words 19.2试用版下载

核心概述类别
WORDSNET-14532改进字体替换API新增功能
WORDSNET-16111LINQ报告中的错误处理新增功能
WORDSNET-15203当LINQ报告语法不正确时,添加更多有用的异常消息新增功能
WORDSNET-17047ActiveX控件渲染//保存为PDF时,单选按钮呈锯齿状增强
WORDSNET-17725从HTML导入后,Border的宽度为零增强
WORDSNET-11331从DOCX转换为DOC/PDF出现空行增强
WORDSNET-17405文本将呈现到下一页增强
WORDSNET-14851PDF中的布局与WORD文档中的布局不同增强
WORDSNET-15008表格内容与页脚重叠,不会转到PDF格式的下一页增强
WORDSNET-16413内容控件在输出PDF中显示在下一个增强
WORDSNET-17532单元格中断包含在下一页增强
WORDSNET-13756为ReportingEngine.BuildReport抛出有意义的异常增强
WORDSNET-17950从Aspose.Words.Tests中提取常用测试代码增强
WORDSNET-17809ReportingEngine.buildReport抛出java.lang.IllegalStateException增强
WORDSNET-17404内容将下推到输出PDF中的下一页增强
WORDSNET-18018DOC / X到PDF - 消耗大量内存并占用太多时间性能
WORDSNET-17911加载大ODT文件会占用太多时间性能
.........

公共API和向后不兼容的更改

这里列出了Aspose.Words 19.2中引入的公共API更改。它不仅包括新的和过时的公共方法,还包括对Aspose.Words中幕后行为的任何变化的描述,这可能会影响现有代码。引入的任何行为都可以被可能修改现有行为,这一点尤为重要,并在此处进行了说明。

调整当保存为PDF时,图像处理问题的警告信息

WORDSNET-17338已经被解决

以前有一个通用警告文本“不支持的图像格式”。现在有一个针对OutOfMemoryException的特定警告,文本“没有足够的内存来加载图像”。以及带有文字的通用警告“无法处理图像。可能不支持的图像格式”。

字体替换过程和公共API的更改

WORDSNET-14532现已解决:

字体提取和替换机制已更改

以前的字体提取过程是:

  1. 确切的字体名称匹配
  2. 从文档中嵌入字体数据
  3. 为字体名称指定的字体替换
  4. FontInfo中的AltName(如果有)和AltName的替代
  5. 如果存在FontInfo并且设置了EnableFontSubstitution,则替换字体
  6. DefaultFontName和DefaultFontName的替代
  7. 可用字体来源的任何字体
  8. “Fanwood”字体嵌入到汇编中

现在字体提取过程是:

  1. 确切的字体名称匹配
  2. 从文档中嵌入字体数据
  3. FontInfo的AltName(如果有的话)
  4. 字体替换规则
    • fontconfig替换
    • 表替换字体名称和alt名称
    • 字体信息替换
    • 默认字体替换
  5. 可用字体来源的任何字体
  6. “Fanwood”字体嵌入到汇编中

为字体替换设置添加了新的公共API。与字体替换相关的之前的API方法/属性已过时

public class FontSettings
{
    /// <summary>
    /// Settings related to font substitution mechanism.
    /// </summary>
    public FontSubstitutionSettings SubstitutionSettings
    { get; }
      
    [Obsolete("This property is obsolete. Please use SubstitutionSettings.DefaultFontSubstitution instead.")]
    public string DefaultFontName
    { get; set; }
          
    [Obsolete("This property is obsolete. Please use SubstitutionSettings.FontInfoSubstitution instead.")]
    public bool EnableFontSubstitution
    { get; set; }
  
    [Obsolete("This method is obsolete. Please use SubstitutionSettings.TableSubstitution instead.")]
    public string[] GetFontSubstitutes(string originalFontName);
          
    [Obsolete("This method is obsolete. Please use SubstitutionSettings.TableSubstitution instead.")]
    public void SetFontSubstitutes(string originalFontName, params string[] substituteFontNames);
          
    [Obsolete("This method is obsolete. Please use SubstitutionSettings.TableSubstitution instead.")]
    public void AddFontSubstitutes(string originalFontName, params string[] substituteFontNames);
}
  
/// <summary>
/// Specifies font substitution mechanism settings.
/// </summary>
/// <remarks>
/// <para>
/// Font substitution process consists of several rules which are checked one by one in specific order.
/// If the first rule can't resolve the font then second rule is checked and so on.</para>
/// <para>The order of the rules is following:
/// 1. Font config substitution rule (disabled by default)
/// 2. Table substitution rule (enabled by default)
/// 3. Font info substitution rule (enabled by default)
/// 4. Default font rule (enabled by default)
/// </para>
/// <para>
/// Note that font info substitution rule will always resolve the font if <see cref="FontInfo"/> is available
/// and will override the default font rule. If you want to use the default font rule then you should disable the
/// font info substitution rule. 
/// </para>
/// <para>
/// Note that font config substitution rule will resolve the font in most cases and thus overrides all other rules. 
/// </para>
/// </remarks>
public class FontSubstitutionSettings
{        
    /// <summary>
    /// Settings related to table substitution rule.
    /// </summary>
    public TableSubstitutionRule TableSubstitution
    { get; }
  
    /// <summary>
    /// Settings related to font info substitution rule.
    /// </summary>
    public FontInfoSubstitutionRule FontInfoSubstitution
    { get; }
  
    /// <summary>
    /// Settings related to default font substitution rule.
    /// </summary>
    public DefaultFontSubstitutionRule DefaultFontSubstitution
    { get; }
  
    /// <summary>
    /// Settings related to font config substitution rule.
    /// </summary>
    public FontConfigSubstitutionRule FontConfigSubstitution
    { get; }
}
  
/// <summary>
/// This is an abstract base class for the font substitution rule.
/// </summary>
public abstract class FontSubstitutionRule
{
    /// <summary>
    /// Specifies whether the rule is enabled or not.
    /// </summary>
    public bool Enabled
    { get; set; }
}
  
/// <summary>
/// Font config substitution rule.
/// </summary>
/// <remarks>
/// <para>
/// This rule uses fontconfig utility on Linux (and other Unix-like) platforms to get the substitution
/// if the original font is not available.
/// </para>
/// <para>
/// If fontconfig utility is not available then this rule will be ignored.
/// </para>
/// </remarks>
public class FontConfigSubstitutionRule : FontSubstitutionRule
{
    /// <summary>
    /// Check if fontconfig utility is available or not.
    /// </summary>
    public bool IsFontConfigAvailable();
  
    /// <summary>
    /// Resets the cache of fontconfig calling results.
    /// </summary>
    public void ResetCache();
}
  
/// <summary>
/// Table font substitution rule.
/// </summary>
/// <remarks>
/// This rule defines the list of substitute font names to be used if the original font is not available.
/// Substitutes will be checked for the font name and the <see cref="FontInfo.AltName"/> (if any).
/// </remarks>
public class TableSubstitutionRule : FontSubstitutionRule
{      
    /// <summary>
    /// Loads table substitution settings from XML file.
    /// </summary>
    /// <param name="fileName">Input file name.</param>
    public void Load(string fileName);
  
    /// <summary>
    /// Loads table substitution settings from XML stream.
    /// </summary>
    /// <param name="stream">Input stream.</param>
    public void Load(Stream stream);
  
    /// <summary>
    /// Loads predefined table substitution settings for Windows platform.
    /// </summary>
    public void LoadWindowsSettings();
          
    /// <summary>
    /// Loads predefined table substitution settings for Linux platform.
    /// </summary>
    public void LoadLinuxSettings();
  
    /// <summary>
    /// Saves the current table substitution settings to file.
    /// </summary>
    /// <param name="fileName">Output file name.</param>
    public void Save(string fileName);
          
    /// <summary>
    /// Saves the current table substitution settings to stream.
    /// </summary>
    /// <param name="outputStream">Output stream.</param>
    public void Save(Stream outputStream);
  
    /// <summary>
    /// Returns array containing substitute font names for the specified original font name.
    /// </summary>
    /// <param name="originalFontName">Original font name.</param>
    /// <returns>List of alternative font names.</returns>
    public IEnumerable<string> GetSubstitutes(string originalFontName);
        
    /// <summary>
    /// Override substitute font names for given original font name.
    /// </summary>
    /// <param name="originalFontName">Original font name.</param>
    /// <param name="substituteFontNames">List of alternative font names.</param>
    public void SetSubstitutes(string originalFontName, IEnumerable<string> substituteFontNames);
  
    /// <summary>
    /// Override substitute font names for given original font name.
    /// </summary>
    /// <param name="originalFontName">Original font name.</param>
    /// <param name="substituteFontNames">List of alternative font names.</param>
    public void SetSubstitutes(string originalFontName, params string[] substituteFontNames);
          
    /// <summary>
    /// Adds substitute font names for given original font name.
    /// </summary>
    /// <param name="originalFontName">Original font name.</param>
    /// <param name="substituteFontNames">List of alternative font names.</param>
    public void AddSubstitutes(string originalFontName, IEnumerable<string> substituteFontNames);
  
    /// <summary>
    /// Adds substitute font names for given original font name.
    /// </summary>
    /// <param name="originalFontName">Original font name.</param>
    /// <param name="substituteFontNames">List of alternative font names.</param>
    public void AddSubstitutes(string originalFontName, params string[] substituteFontNames);
}
  
/// <summary>
/// Font info substitution rule.
/// </summary>
/// <remarks>
/// According to this rule Aspose.Words evaluates all the related fields in <see cref="FontInfo"/> (Panose, Sig etc) for
/// the missing font and finds the closest match among the available font sources. If <see cref="FontInfo"/> is not
/// available for the missing font then nothing will be done.
/// </remarks>
public class FontInfoSubstitutionRule : FontSubstitutionRule
{ }
  
/// <summary>
/// Default font substitution rule.
/// </summary>
/// <remarks>
/// This rule defines single default font name to be used for substitution if the original font is not available.
/// </remarks>
public class DefaultFontSubstitutionRule : FontSubstitutionRule
{
    /// <summary>
    /// Gets or sets the default font name.
    /// </summary>
    /// <remarks>
    /// <para>The default value is 'Times New Roman'.</para>
    /// </remarks>
    public string DefaultFontName
    { get; set; }
}

删除了不推荐使用的公共属性TxtSaveOptions.ExportHeadersFooters

问题:WORDSNET-17560

删除已弃用的公共属性TxtSaveOptions.ExportHeadersFooters:

// Specifies whether to output headers and footers when exporting in plain text format.// Default value is true.public bool ExportHeadersFooters

请改用TxtSaveOptions.ExportHeadersFootersMode属性。

点击查看完整更新内容