原創|產品更新|編輯:李顯亮|2020-06-04 10:26:35.013|閱讀 212 次
概述:Aspose.Words for .Net更新至新版本v20.6,Font.EmphasisMark向公眾公開,引入了MarkdownSaveOptions類,PDF版本1.5標記為過時,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
六月已至,.NET版Aspose.Words也為大家帶來了6月的新版本!Aspose.Words for .Net是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和打印文檔,而無需在跨平臺應用程序中直接使用Microsoft Word。
主要特點如下:
>>你可以點擊這里下載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的轉換,有時在新頁面上重復行 | 增強功能 | 
/// <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);
/// <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 //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);
/// <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);;
/// <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的優劣,您的感受對我們相當寶貴哦~ 
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn