原創(chuàng)|產(chǎn)品更新|編輯:李顯亮|2021-02-18 10:00:40.893|閱讀 259 次
概述:Aspose.Words for .Net更新至新版本v21.2,此常規(guī)的每月版本中有86項(xiàng)改進(jìn)和修復(fù),包括9項(xiàng)新功能的發(fā)布,歡迎下載體驗(yàn)。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
Aspose.Words for .Net是一種高級(jí)Word文檔處理API,用于執(zhí)行各種文檔管理和操作任務(wù)。API支持生成,修改,轉(zhuǎn)換,呈現(xiàn)和打印文檔,而無(wú)需在跨平臺(tái)應(yīng)用程序中直接使用Microsoft Word。2021年2月更新來(lái)啦,.NET版Aspose.Words更新至v21.2新版本!
主要特點(diǎn)如下:
>>你可以點(diǎn)擊這里下載Aspose.Words for .NET v21.2測(cè)試體驗(yàn)。
關(guān)鍵 | 概括 | 類別 |
WORDSNET-21363 | 支持為L(zhǎng)INQ Reporting Engine動(dòng)態(tài)添加組合框和下拉列表項(xiàng) | 新功能 |
WORDSNET-6146 | 允許從OLE對(duì)象提取可見(jiàn)的純文本 | 新功能 |
WORDSNET11848 | 添加保存選項(xiàng)以模仿MS Word行為或不模仿創(chuàng)建,修改和打印日期 | 新功能 |
WORDSNET-6125 | 添加選項(xiàng)以將文檔中的圖像導(dǎo)出為SVG格式的HTML | 新功能 |
WORDSNET-10148 | 提供移動(dòng)到段落中特定字符的能力 | 新功能 |
WORDSNET-20863 | 在Azure上將DOCX轉(zhuǎn)換為PDF時(shí),內(nèi)容控制日期會(huì)更改 | 新功能 |
WORDSNET-21639 | LegacyMode = false時(shí),Range.Replace引發(fā)System.IndexOutOfRangeException | 新功能 |
WORDSNET-21183 | 將自定義字體樣式設(shè)置為“鏈接到主題”字體不起作用 | 新功能 |
WORDSNET-20546 | ComHelper.Open不會(huì)使用Delphi從流中導(dǎo)入RTF | 新功能 |
WORDSNET-20414 | PdfDocumentReader插件鏡像希伯來(lái)語(yǔ)文本 | 增強(qiáng)功能 |
WORDSNET-9605 | 支持DrawingML 3D效果的渲染 | 增強(qiáng)功能 |
WORDSNET-15833 | 改善在MS Word 97中創(chuàng)建的渲染形狀線的兼容性 | 增強(qiáng)功能 |
WORDSNET-10441 | 支持Word 6.0 / 95的圖形對(duì)象 | 增強(qiáng)功能 |
WORDSNET-2799 | 嘗試恢復(fù)損壞的進(jìn)口文件 | 增強(qiáng)功能 |
WORDSNET-1738 | 在保存DOCX文件期間優(yōu)化內(nèi)存使用 | 增強(qiáng)功能 |
WORDSNET-21652 | 沒(méi)有將生成器名稱寫入XamlFixed / XamlFlow / XamlFlowPack / HtmlFixed文檔 | 增強(qiáng)功能 |
完整更新細(xì)則請(qǐng)參考:【Aspose.Words for .NET v21.2更新說(shuō)明】
用例如下:
Document doc = new Document(docPath); SaveOptions saveOptions = new PdfSaveOptions(); saveOptions.UpdateLastPrintedProperty = true; doc.Save(pdfPath, saveOptions);
向Font對(duì)象添加了新的公共屬性:
還添加了相應(yīng)的公共枚舉:
用例:說(shuō)明如何創(chuàng)建和使用主題樣式。
Document doc = new Document("input.docx"); DocumentBuilder builder = new DocumentBuilder(doc); builder.MoveToDocumentEnd(); builder.Writeln(); // Create some style with theme font properties. Style style = doc.Styles.Add(StyleType.Paragraph, "ThemedStyle"); style.Font.ThemeFont = ThemeFont.Major; style.Font.ThemeColor = ThemeColor.Accent5; style.Font.TintAndShade = 0.3; builder.ParagraphFormat.StyleName = "ThemedStyle"; builder.Writeln("Text with themed style"); // Get just inserted run. Run run = (Run)((Paragraph)builder.CurrentParagraph.PreviousSibling).FirstChild; Console.WriteLine("Theme color: {0}", run.Font.ThemeColor); Console.WriteLine("Color: {0}\n", run.Font.Color); Console.WriteLine("TintAndShade: {0:N2}\n", run.Font.TintAndShade); Console.WriteLine("Theme font: {0}", run.Font.ThemeFont); Console.WriteLine("Font: {0}\n", run.Font.Name); Console.WriteLine("Theme font Ascii: {0}", run.Font.ThemeFontAscii); Console.WriteLine("Font Ascii: {0}\n", run.Font.NameAscii); Console.WriteLine("Theme font Bi: {0}", run.Font.ThemeFontBi); Console.WriteLine("Font Bi: {0}\n", run.Font.NameBi); Console.WriteLine("Theme font EastAsian: {0}", run.Font.ThemeFontFarEast); Console.WriteLine("Font EastAsian: {0}\n", run.Font.NameFarEast); Console.WriteLine("Theme font Other: {0}", run.Font.ThemeFontOther); Console.Write("Font Other: {0}", run.Font.NameOther); /* This code example produces the following results: Theme color: Accent5 Color: Color [Empty] TintAndShade: 0.30 Theme font: Major Font: Calibri Light Theme font Ascii: Major Font Ascii: Calibri Light Theme font Bi: Major Font Bi: Times New Roman Theme font EastAsian: Major Font EastAsian: Times New Roman Theme font Other: Major Font Other: Calibri Light */
用例:介紹如何通過(guò)應(yīng)用主題字體“無(wú)”將非主題字體名稱更改為主題字體,反之亦然。
// Create new document with themes. Document doc = new Document(); doc.Theme.MinorFonts.Latin = "Algerian"; doc.Theme.MinorFonts.EastAsian = "Aharoni"; doc.Theme.MinorFonts.ComplexScript = "Andalus"; // Check original theme font. Font font = doc.Styles["Normal"].Font; Console.WriteLine("Originally the Normal style theme font is: {0}\n", font.ThemeFont); // Apply theme font 'Minor' font.ThemeFont = ThemeFont.Minor; Console.WriteLine("'Minor' theme font is applied:"); Console.WriteLine("Theme font: {0}", font.ThemeFont); Console.WriteLine("Font: {0}\n", font.Name); Console.WriteLine("Theme font Ascii: {0}", font.ThemeFontAscii); Console.WriteLine("Font Ascii: {0}\n", font.NameAscii); Console.WriteLine("Theme font Bi: {0}", font.ThemeFontBi); Console.WriteLine("Font Bi: {0}\n", font.NameBi); Console.WriteLine("Theme font EastAsian: {0}", font.ThemeFontFarEast); Console.WriteLine("Font EastAsian: {0}\n", font.NameFarEast); Console.WriteLine("Theme font Other: {0}", font.ThemeFontOther); Console.WriteLine("Font Other: {0}\n\n", font.NameOther); // Set non-theme font. font.ThemeFont = ThemeFont.None; Console.WriteLine("'None' theme font is applied:"); Console.WriteLine("Theme font: {0}", font.ThemeFont); Console.WriteLine("Font: {0}\n", font.Name); Console.WriteLine("Theme font Ascii: {0}", font.ThemeFontAscii); Console.WriteLine("Font Ascii: {0}\n", font.NameAscii); Console.WriteLine("Theme font Bi: {0}", font.ThemeFontBi); Console.WriteLine("Font Bi: {0}\n", font.NameBi); Console.WriteLine("Theme font EastAsian: {0}", font.ThemeFontFarEast); Console.WriteLine("Font EastAsian: {0}\n", font.NameFarEast); Console.WriteLine("Theme font Other: {0}", font.ThemeFontOther); Console.Write("Font Other: {0}\n", font.NameOther); /* This code example produces the following results: Originally the Normal style theme font is: None 'Minor' theme font is applied: Theme font: Minor Font: Algerian Theme font Ascii: Minor Font Ascii: Algerian Theme font Bi: Minor Font Bi: Andalus Theme font EastAsian: Minor Font EastAsian: Aharoni Theme font Other: Minor Font Other: Algerian 'None' theme font is applied: Theme font: None Font: Algerian Theme font Ascii: None Font Ascii: Algerian Theme font Bi: None Font Bi: Andalus Theme font EastAsian: None Font EastAsian: Aharoni Theme font Other: None Font Other: Algerian */
用例:介紹如何通過(guò)應(yīng)用一些簡(jiǎn)單的字體名稱將非主題字體名稱更改為主題字體,反之亦然。
// Create new document with themes. Document doc = new Document(); doc.Theme.MinorFonts.Latin = "Algerian"; doc.Theme.MinorFonts.EastAsian = "Aharoni"; doc.Theme.MinorFonts.ComplexScript = "Andalus"; // Check original theme font. Font font = doc.Styles["Normal"].Font; Console.WriteLine("Originally the Normal style theme font is: {0}\n", font.ThemeFont); // Apply theme font 'Minor' font.ThemeFont = ThemeFont.Minor; Console.WriteLine("'Minor' theme font is applied:"); Console.WriteLine("Theme font: {0}", font.ThemeFont); Console.WriteLine("Font: {0}\n", font.Name); Console.WriteLine("Theme font Ascii: {0}", font.ThemeFontAscii); Console.WriteLine("Font Ascii: {0}\n", font.NameAscii); Console.WriteLine("Theme font Bi: {0}", font.ThemeFontBi); Console.WriteLine("Font Bi: {0}\n", font.NameBi); Console.WriteLine("Theme font EastAsian: {0}", font.ThemeFontFarEast); Console.WriteLine("Font EastAsian: {0}\n", font.NameFarEast); Console.WriteLine("Theme font Other: {0}", font.ThemeFontOther); Console.WriteLine("Font Other: {0}\n\n", font.NameOther); // Set non-theme font name. font.Name = "Arial"; Console.WriteLine("Non-themed font name is applied:"); Console.WriteLine("Theme font: {0}", font.ThemeFont); Console.WriteLine("Font: {0}\n", font.Name); Console.WriteLine("Theme font Ascii: {0}", font.ThemeFontAscii); Console.WriteLine("Font Ascii: {0}\n", font.NameAscii); Console.WriteLine("Theme font Bi: {0}", font.ThemeFontBi); Console.WriteLine("Font Bi: {0}\n", font.NameBi); Console.WriteLine("Theme font EastAsian: {0}", font.ThemeFontFarEast); Console.WriteLine("Font EastAsian: {0}\n", font.NameFarEast); Console.WriteLine("Theme font Other: {0}", font.ThemeFontOther); Console.Write("Font Other: {0}", font.NameOther); /* This code example produces the following results: Originally the Normal style theme font is: None 'Minor' theme font is applied: Theme font: Minor Font: Algerian Theme font Ascii: Minor Font Ascii: Algerian Theme font Bi: Minor Font Bi: Andalus Theme font EastAsian: Minor Font EastAsian: Aharoni Theme font Other: Minor Font Other: Algerian Non-themed font name is applied: Theme font: None Font: Arial Theme font Ascii: None Font Ascii: Arial Theme font Bi: None Font Bi: Arial Theme font EastAsian: None Font EastAsian: Arial Theme font Other: None Font Other: Arial */
用例:說(shuō)明如何通過(guò)應(yīng)用主題字體顏色“無(wú)”將非主題顏色更改為主題顏色,反之亦然。
Document doc = new Document(); // Check original theme color. Font font = doc.Styles["Normal"].Font; Console.WriteLine("Originally the Normal style theme color is: {0} and RGB color is: {1}\n", font.ThemeColor, font.Color); // Apply theme color. font.ThemeColor = ThemeColor.Accent2; Console.WriteLine("'Accent2' theme color is applied:"); Console.WriteLine("Theme color: {0}", font.ThemeColor); Console.WriteLine("RGB color: {0}\n", font.Color); // Set theme color back to 'None'. font.ThemeColor = ThemeColor.None; Console.WriteLine("Theme color 'None' is applied:"); Console.WriteLine("Theme color: {0}", font.ThemeColor); Console.WriteLine("RGB color: {0}", font.Color); /* This code example produces the following results: Originally the Normal style theme color is: None and RGB color is: Color [Empty] 'Accent2' theme color is applied: Theme color: Accent2 RGB color: Color [Empty] Theme color 'None' is applied: Theme color: None RGB color: Color [Empty] */
用例:說(shuō)明如何通過(guò)應(yīng)用一些簡(jiǎn)單的RGB顏色將非主題字體名稱更改為主題字體名稱,反之亦然。
Document doc = new Document(); // Check original theme color. Font font = doc.Styles["Normal"].Font; Console.WriteLine("Originally the Normal style theme color is: {0} and RGB color is: {1}\n", font.ThemeColor, font.Color); // Apply theme color. font.ThemeColor = ThemeColor.Accent2; Console.WriteLine("'Accent2' theme color is applied:"); Console.WriteLine("Theme color: {0}", font.ThemeColor); Console.WriteLine("RGB color: {0}\n", font.Color); // Set simple RGB color. font.Color = Color.Blue; font.ThemeColor = ThemeColor.None; Console.WriteLine("RGB color is applied:"); Console.WriteLine("Theme color: {0}", font.ThemeColor); Console.WriteLine("RGB color: {0}", font.Color); /* This code example produces the following results: Originally the Normal style theme color is: None and RGB color is: Color [Empty] 'Accent2' theme color is applied: Theme color: Accent2 RGB color: Color [Empty] RGB color is applied: Theme color: None RGB color: Color [A=255, R=0, G=0, B=255] */
用例:說(shuō)明如何使用Font.TintAndShade屬性。
Document doc = new Document(); Font font = doc.Styles["Normal"].Font; font.ThemeColor = ThemeColor.Accent6; font.TintAndShade = -0.25; Console.WriteLine("TintAndShade is set to {0:N2}", font.TintAndShade); Console.WriteLine("Theme color: {0}", font.ThemeColor); Console.WriteLine("RGB color: {0}", font.Color); /* This code example produces the following results: TintAndShade is set to -0.25 Theme color: Accent6 RGB color: Color [Empty] */
向FindReplaceOptions對(duì)象添加了一個(gè)新的公共屬性:
用例:說(shuō)明如何使用SmartParagraphBreakReplacement屬性。
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create two tables with paragraph and inner table in first cell: // ┌───────────────────────┐ // │ TEXT1? │ // │ ┌───────────────────┐ │ // │ |? | | // | └───────────────────┘ │ // └───────────────────────┘ // ┌───────────────────────┐ // │ TEXT2? │ // │ ┌───────────────────┐ │ // │ |? | | // | └───────────────────┘ │ // └───────────────────────┘ builder.StartTable(); builder.InsertCell(); builder.Write("TEXT1"); builder.StartTable(); builder.InsertCell(); builder.EndTable(); builder.EndTable(); builder.Writeln(); builder.StartTable(); builder.InsertCell(); builder.Write("TEXT2"); builder.StartTable(); builder.InsertCell(); builder.EndTable(); builder.EndTable(); builder.Writeln(); FindReplaceOptions options = new FindReplaceOptions(); // When the following option is set to 'true', // Aspose.Words will remove paragraph's text completely with its paragraph mark. options.SmartParagraphBreakReplacement = true; doc.Range.Replace(new Regex(@"TEXT1&p"), "", options); // But if the option is set to 'false', // Aspose.Words will mimic Word and remove only paragraph's text and leaves the paragraph mark intact. options.SmartParagraphBreakReplacement = false; doc.Range.Replace(new Regex(@"TEXT2&p"), "", options); doc.Save("out.docx"); // This code example produces the following results: // ┌───────────────────────┐ // │ ┌───────────────────┐ │ // │ |? | | // | └───────────────────┘ │ // └───────────────────────┘ // ┌───────────────────────┐ // │ ? │ // │ ┌───────────────────┐ │ // │ |? | | // | └───────────────────┘ │ // └───────────────────────┘
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn