翻譯|使用教程|編輯:李顯亮|2020-04-16 10:08:34.170|閱讀 2080 次
概述:Aspose.Words For .NET是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。接下來我們將進入關于“水印處理”的介紹,在Aspose.Words中學會如何設置字體格式并獲取行距。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Aspose.Words For .NET是一種高級Word文檔處理API,用于執行各種文檔管理和操作任務。API支持生成,修改,轉換,呈現和打印文檔,而無需在跨平臺應用程序中直接使用Microsoft Word。此外,API支持所有流行的Word處理文件格式,并允許將Word文檔導出或轉換為固定布局文件格式和最常用的圖像/多媒體格式。
>>Aspose.Words for .NET已經更新至v20.4,Aspose.Words for .Net更新至新版本v20.4,主要新增5大特點,包括:支持閱讀PDF文檔;提供了更改亞洲段落間距和縮進的功能;為PDF渲染添加了圖像插值選項;添加了新的模式3D形狀渲染;圖表數據標簽和系列的擴展API,點擊下載體驗
當前字體格式由DocumentBuilder.Font屬性返回的Font對象表示。Font類包含Microsoft Word中可能存在的各種字體屬性。 下例顯示了如何設置字體格式。
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Set font formatting properties Font font = builder.Font; font.Bold = true; font.Color = System.Drawing.Color.DarkBlue; font.Italic = true; font.Name = "Arial"; font.Size = 24; font.Spacing = 5; font.Underline = Underline.Double; // Output formatted text builder.Writeln("I'm a very nice formatted string."); dataDir = dataDir + "DocumentBuilderSetFontFormatting_out.doc"; doc.Save(dataDir);
字體的行距是兩行連續文本的基線之間的垂直距離。因此,行距包括行之間的空白以及字符本身的高度。
如以下示例所示,在Font類中引入了LineSpacing屬性以獲得該值:
// The path to the documents directory. string dataDir = RunExamples.GetDataDir_WorkingWithDocument(); // Initialize document. Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); builder.Font.Name = "Calibri"; builder.Writeln("qText"); // Obtain line spacing. Font font = builder.Document.FirstSection.Body.FirstParagraph.Runs[0].Font; Console.WriteLine($"lineSpacing = {font.LineSpacing}");還想要更多嗎?您可以點擊閱讀【2019 · Aspose最新資源整合】,查找需要的教程資源。如果您有任何疑問或需求,請隨時加入Aspose技術交流群(642018183),我們很高興為您提供查詢和咨詢。
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn