原創|產品更新|編輯:李顯亮|2021-04-12 10:16:06.840|閱讀 310 次
概述:Aspose.Words for Java更新至新版本v21.4,此常規的每月版本中有102個改進和修補程序,包括添加了刪除未使用的內置樣式的功能、擴展了結構化文檔標簽范圍的公共API等,歡迎下載體驗。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
隨著.NET版Aspose.Words for .Net v21.4的發布,Java版也隨之更新,除了一些通用功能外,也獨有新改善。
Aspose.Words for Java是一種高級Java Word處理API,使您可以直接在Java應用程序中執行各種文檔處理任務,無需Microsoft Word即可生成,修改和轉換文檔。
主要特點如下:
>>你可以點擊這里下載Aspose.Words for Java v21.4測試體驗。
由于對Aspose.Words命名空間的重構工作,CompareOptions,ComparisonTargetTargetType,Granularity類被移至新的單獨命名空間Aspose.Words.Comparing。如果出現編譯錯誤-請使用Aspose.Words.Comparing添加。
由于對Aspose.Words命名空間的重構工作,Footnote,EndnoteOptions,FootnoteOptions,EndnotePosition,FootnotePosition,FootnoteType,FootnoteNumberingRule類已移至新的單獨命名空間Aspose.Words.Notes。如果出現編譯錯誤-請使用Aspose.Words.Notes添加。
使用GDI +或SkiaSharp保存到圖像時(即在所有.NET平臺和.NET Standard上),現在支持高級字體。用例:使用高級排版功能將文檔保存到圖像。
Document doc = new Document("input.docx"); doc.LayoutOptions.TextShaperFactory = HarfBuzzTextShaperFactory.Instance; doc.Save("output.png");
將以下新的公共方法添加到Fill類中:
用例:說明如何將填充更改為實體。
// Open some document with text effects. Document doc = new Document("TextTwoColorGradient.docx"); // Get Fill object for Font of the first Run. Fill fill = doc.FirstSection.Body.FirstParagraph.Runs[0].Font.Fill; // Check Fill properties of the Font. Console.WriteLine("The type of the fill is: {0}", fill.FillType); Console.WriteLine("The foreground color of the fill is: {0}", fill.ForeColor); Console.WriteLine("The fill is transparent at {0}%", fill.Transparency * 100); // Change type of the fill to Solid with uniform green color. fill.Solid(Color.Green); Console.WriteLine("\nThe fill is changed:"); Console.WriteLine("The type of the fill is: {0}", fill.FillType); Console.WriteLine("The foreground color of the fill is: {0}", fill.ForeColor); Console.WriteLine("The fill transparency is {0}%", fill.Transparency * 100); doc.Save("TextSolidOut.docx"); /* This code example produces the following results: The type of the fill is: Gradient The foreground color of the fill is: Color [A=255, R=0, G=128, B=128] The fill is transparent at 65% The fill is changed: The type of the fill is: Solid The foreground color of the fill is: Color [A=255, R=0, G=128, B=0] The fill transparency is 0% */
StructuredDocumentTagRangeStart和StructuredDocumentTagRangeEnd類的構造函數已公開。現在可以手動創建這些類的實例。
用例:
Document doc = new Document("input.docx"); StructuredDocumentTagRangeStart start = new StructuredDocumentTagRangeStart(doc, SdtType.RepeatingSectionItem); StructuredDocumentTagRangeEnd end = new StructuredDocumentTagRangeEnd(doc, start.Id); doc.FirstSection.Body.InsertAfter(start, doc.FirstSection.Body.FirstParagraph); doc.LastSection.Body.InsertBefore(end, doc.LastSection.Body.LastParagraph); doc.Save("output.docx"); IEnumerable interface is implemented in StructuredDocumentTagRangeStart class for full LINQ support (i.e. Last(), LastOrDefault() and other methods). Document doc = new Document("input.docx"); StructuredDocumentTagRangeStart start = (StructuredDocumentTagRangeStart)doc.FirstSection.Body.GetChild(NodeType.StructuredDocumentTagRangeStart, 0, false); Console.WriteLine(start.LastOrDefault().GetText());
如果你想試用Aspose的全部完整功能,可 聯系在線客服獲取30天臨時授權體驗。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn