.NET版文档管理利器Aspose.Words v20.6发布!PDF版本1.5标记为过时

原创|产品更新|编辑:李显亮|2020-06-04 10:26:35.013|阅读 18 次

概述:Aspose.Words for .Net更新至新版本v20.6,Font.EmphasisMark向公众公开,引入了MarkdownSaveOptions类,PDF版本1.5标记为过时,欢迎下载体验。

# 您正在找协同办公软件吗?点击这里站长给您推荐 #

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

主要特点如下:

  • Font.EmphasisMark向公众公开
  • 添加了新的公共属性ImportFormatOptions.IgnoreHeaderFooter
  • 引入了MarkdownSaveOptions类
  • 提供了用于控制LINQ Reporting Engine的JSON简单值识别的选项

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

具体更新内容

key 概述 类别
WORDSNET-13983 添加功能以支持“标记上的强调”字体设置 新功能
WORDSNET-19976 字体嵌入效果很好,但是符号未正确保存到PDF 新功能
WORDSNET-20513 检查Aspose.Words for .NET如何与.NET 5.0一起使用 新功能
WORDSNET-20488 LINQ Reporting Engine-提供一种使用JsonDataSource的准确格式解析日期时间值的方法 新功能
WORDSNET-19979 LINQ Reporting Engine-提供一种模式,可根据JSON表示法本身确定JSON简单值的类型 新功能
WORDSNET-20297 添加使用SaveOptions创建MarkdownSaveOptions的功能 新功能
WORDSNET-20491 加载PDF时发生System.IO.FileLoadException 增强功能
WORDSNET-20492 PDF到Word的转换,有时在新页面上重复行 增强功能
完整更新细则请参考:【Aspose.Words for .NET v20.6更新说明】

公共API更改

①添加了新的公共类MarkdownSaveOptions

/// <summary>
/// Class to specify additional options when saving a document into the <see cref="Words.SaveFormat.Markdown"/> format.
/// </summary>
public class MarkdownSaveOptions : TxtSaveOptionsBase

暂时只有以下几个公共API:

/// <summary>
/// Specifies the format in which the document will be saved if this save options object is used.
/// Can only be <see cref="Words.SaveFormat.Markdown"/>.
/// </summary>
public override SaveFormat SaveFormat

注意,将TxtSaveOptionsBase.PreserveTableLayout移至TxtSaveOptions.PreserveTableLayout:

/// <summary>
/// Specifies whether the program should attempt to preserve layout of tables when saving in the plain text format.
/// The default value is <b>false</b>.
/// </summary>
public bool PreserveTableLayout

用例。说明如何创建和使用MarkdownSaveOptions对象:

DocumentBuilder builder = new DocumentBuilder();
builder.Writeln("Some text!");
  
MarkdownSaveOptions saveOptions = (MarkdownSaveOptions)SaveOptions.CreateSaveOptions(SaveFormat.Markdown);
builder.Document.Save("TestDocument.md", saveOptions);

②添加了新的公共属性Font.EmphasisMark

/// <summary>
/// Gets or sets the emphasis mark applied to this formatting.
/// </summary>
public EmphasisMark EmphasisMark

强调标记是一个附加字符,它在下面的枚举中指定的主字符字形之上或之下呈现。

/// <summary>
/// Specifies possible types of emphasis mark.
/// </summary>
/// <dev>
/// Names borrowed from https://docs.microsoft.com/en-us/dotnet/api/microsoft.office.interop.word.wdemphasismark?view=word-pia
/// </dev>
public enum EmphasisMark
{
    /// <summary>
    /// No emphasis mark.
    /// </summary>
    None = 0x00,
  
    /// <summary>
    /// Emphasis mark is a solid black circle displayed above text.
    /// </summary>
    OverSolidCircle = 0x01,
  
    /// <summary>
    /// Emphasis mark is a comma character displayed above text.
    /// </summary>
    OverComma = 0x02,
  
    /// <summary>
    /// Emphasis mark is an empty white circle displayed above text.
    /// </summary>
    OverWhiteCircle = 0x03,
  
    /// <summary>
    /// Emphasis mark is a solid black circle displayed below text.
    /// </summary>
    UnderSolidCircle = 0x04,
}

用例。说明如何通过DocumentBuilder设置Font.EmphasisMark:

Document document = new Document();
DocumentBuilder builder = new DocumentBuilder(document);
  
builder.Font.EmphasisMark = EmphasisMark.UnderSolidCircle;
  
builder.Write("Emphasis text");
builder.Writeln();
builder.Font.ClearFormatting();
builder.Write("Simple text");
  
document.Save(savePath, saveOptions);

③添加了新的公共属性ImportFormatOptions.IgnoreHeaderFooter

/// <summary>
/// Gets or sets a boolean value that specifies that source formatting of headers/footers content ignored
/// if ImportFormatMode.KeepSourceFormatting mode is used.
/// The default value is true.
/// </summary>

默认情况下,保留Word的行为是对的。用例:

Document dstDocument = new Document(dstDocumentPath);
Document srcDocument = new Document(srcDocumentPath);
  
ImportFormatOptions importFormatOptions = new ImportFormatOptions();
importFormatOptions.IgnoreHeaderFooter = false;
  
dstDocument.AppendDocument(srcDocument, ImportFormatMode.KeepSourceFormatting, importFormatOptions);;

④添加了新的公共属性MarkdownSaveOptions.TableContentAlignment

/// <summary>
/// Gets or sets a value that specifies how to align contents in tables
/// when exporting into the <see cref="Words.SaveFormat.Markdown"/> format.
/// The default value is <see cref="Saving.TableContentAlignment.Auto"/>. 
/// </summary>
public TableContentAlignment TableContentAlignment { get; set; }

此外,还添加了一个新的公共枚举:

/// <summary>
/// Allows to specify the alignment of the content of the table to be used when exporting into Markdown format.
/// </summary>
public enum TableContentAlignment
{
    /// <summary>
    /// The alignment will be taken from the first paragraph in corresponding table column.
    /// </summary>
    Auto,
    /// <summary>
    /// The content of tables will be aligned to the Left.
    /// </summary>
    Left,
    /// <summary>
    /// The content of tables will be aligned to the Center.
    /// </summary>
    Center,
    /// <summary>
    /// The content of tables will be aligned to the Right.
    /// </summary>
    Right
}

用例。说明导出到Markdown时如何在表格内对齐内容:

  
MarkdownSaveOptions saveOptions = new MarkdownSaveOptions();
// Makes all paragraphs inside table to be aligned to Left. 
saveOptions.TableContentAlignment = TableContentAlignment.Left;
builder.Document.Save("left.md", saveOptions);
  
// Makes all paragraphs inside table to be aligned to Right. 
saveOptions.TableContentAlignment = TableContentAlignment.Right;
builder.Document.Save("right.md", saveOptions);
  
// Makes all paragraphs inside table to be aligned to Center. 
saveOptions.TableContentAlignment = TableContentAlignment.Center;
builder.Document.Save("center.md", saveOptions);
  
// Makes all paragraphs inside table to be aligned automatically.
// The alignment in this case will be taken from the first paragraph in corresponding table column.
saveOptions.TableContentAlignment = TableContentAlignment.Auto;
builder.Document.Save("auto.md", saveOptions);
Aspose是目前国内外非常火爆且功能强大的文件格式敏捷开发控件,但因为产品众多、技术问题复杂等因素,也常常遭受开发人员吐槽。如果您也正在使用Aspose相关产品,点击下方按钮,来谈谈Aspose的优劣,您的感受对我们相当宝贵哦~

一起聊聊Aspose的感受吧



标签:

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

登录 慧都网发表评论


暂无评论...

为你推荐

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

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

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