精華|使用教程|編輯:顏馨|2023-04-11 17:17:27.683|閱讀 115 次
概述:本文主要介紹如何在C#C#和VB.NET中插入 Word 中的尾注,歡迎查閱!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Spire.Doc for .NET是一款專門對 Word 文檔進行操作的 .NET 類庫。在于幫助開發人員無需安裝 Microsoft Word情況下,輕松快捷高效地創建、編輯、轉換和打印 Microsoft Word 文檔。擁有近10年專業開發經驗Spire系列辦公文檔開發工具,專注于創建、編輯、轉換和打印Word/PDF/Excel等格式文件處理,小巧便捷。
E-iceblue 功能類庫Spire 系列文檔處理組件均由中國本土團隊研發,不依賴第三方軟件,不受其他國家的技術或法律法規限制,同時適配國產操作系統如中科方德、中標麒麟等,兼容國產文檔處理軟件 WPS(如 .wps/.et/.dps 等格式
單詞尾注通常放在文檔的末尾,它提供了引用的單詞/句子/段落的引用。它包括兩部分,標記和文本。標記可以自動定制或訂購(i,ii,iii...)。添加、刪除或移動一個尾注時,標記將自動重新排序。
Spire.Doc for .NET,一個用于操作 .NET 應用程序的 Word 文檔的獨立組件,使用戶能夠使用 C# VB.NET 在 Word 中插入尾注。本指南介紹了如何通過 Spire.Doc for .NET 實現此功能的方法。
由于尾注包含在腳注類中,因此調用 p.AppendFootnote(FootnoteType.Endnote) 插入尾注的方法。然后,使用 尾注。TextBody.AddParagraph()。追加文本(字符串) 方法添加文本并為尾注文本和標記格式設置字符格式和標記字符格式屬性。 下載并安裝 Spire.Doc for .NET 并使用以下代碼在 Word 中插入尾注。
[C#]
using System.Drawing; using Spire.Doc; using Spire.Doc.Documents; using Spire.Doc.Fields; namespace WordEndnote { class InsertEndnote { static void Main(string[] args) { //Load Document Document doc = new Document(); doc.LoadFromFile(@"E:\Work\Documents\WordDocuments\Antarctic.docx", FileFormat.Docx); Section s = doc.Sections[0]; Paragraph p = s.Paragraphs[3]; //Add Footnote Footnote endnote = p.AppendFootnote(FootnoteType.Endnote); //Append Text TextRange text = endnote.TextBody.AddParagraph().AppendText("Reference: Wikipedia"); //Text Format text.CharacterFormat.FontName = "Impact"; text.CharacterFormat.FontSize = 14; text.CharacterFormat.TextColor = Color.DarkOrange; //Marker Format endnote.MarkerCharacterFormat.FontName = "Calibri"; endnote.MarkerCharacterFormat.FontSize = 14; endnote.MarkerCharacterFormat.TextColor = Color.DarkBlue; //Save and Launch doc.SaveToFile("Endnote.docx", FileFormat.Docx); System.Diagnostics.Process.Start("Endnote.docx"); } } }
[VB.NET]
Imports System.Drawing Imports Spire.Doc Imports Spire.Doc.Documents Imports Spire.Doc.Fields Namespace WordEndnote Friend Class InsertEndnote Shared Sub Main(ByVal args() As String) 'Load Document Dim doc As New Document() doc.LoadFromFile("E:\Work\Documents\WordDocuments\Antarctic.docx", FileFormat.Docx) Dim s As Section = doc.Sections(0) Dim p As Paragraph = s.Paragraphs(3) 'Add Footnote Dim endnote As Footnote = p.AppendFootnote(FootnoteType.Endnote) 'Append Text Dim text As TextRange = endnote.TextBody.AddParagraph().AppendText("Reference: Wikipedia") 'Text Format text.CharacterFormat.FontName = "Impact" text.CharacterFormat.FontSize = 14 text.CharacterFormat.TextColor = Color.DarkOrange 'Marker Format endnote.MarkerCharacterFormat.FontName = "Calibri" endnote.MarkerCharacterFormat.FontSize = 14 endnote.MarkerCharacterFormat.TextColor = Color.DarkBlue 'Save and Launch doc.SaveToFile("Endnote.docx", FileFormat.Docx) System.Diagnostics.Process.Start("Endnote.docx") End Sub End Class End Namespace
Spire.Doc是一個Microsoft Word組件,它使用戶能夠直接執行各種Word文檔處理任務,例如在WPF,.NET和Silverlight中生成,讀取,寫入和修改Word文檔。
以上便是在 C#和VB.NET中插入 Word 中的尾注的教程,如果您有其他問題也可以繼續瀏覽本系列文章,獲取相關教程,你還可以給我留言或者加入我們的官方技術交流群。
歡迎下載|體驗更多E-iceblue產品
獲取更多信息請咨詢 ;技術交流Q群(767755948)
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn