翻譯|使用教程|編輯:胡濤|2022-11-28 11:17:54.683|閱讀 241 次
概述:在本文中,您將學習如何使用spire.doc 在 C#、VB.NET 中插入 Word 注釋
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Spire.Doc for .NET是一款專門對 Word 文檔進行操作的 .NET 類庫。在于幫助開發人員無需安裝 Microsoft Word情況下,輕松快捷高效地創建、編輯、轉換和打印 Microsoft Word 文檔。擁有近10年專業開發經驗Spire系列辦公文檔開發工具,專注于創建、編輯、轉換和打印Word/PDF/Excel等格式文件處理,小巧便捷。
文字注釋,由用戶插入以顯示對單詞、短語或段落的意見或附加信息,經常出現在文檔頁邊空白處。讀者可以根據評論了解更多關于內容的信息或修改內容以更正確或更清楚地表達自己的想法。
N是一個專業的.NET Word 組件,用于操作Word 文檔,使用戶能夠使用C#、VB.NET 在Word 中插入注釋。用戶可以直接調用 paragraph.AppendComment(string) 方法為指定段落插入注釋。此外,Spire.Doc for .NET 還為用戶提供了 Comment 類。用戶可以使用此類提供的 Format 屬性來設置格式注釋。
下面演示了評論可以有多完美。您也可以免費下載 Spire.Doc并進行試用。
[C#]
using Spire.Doc;
using Spire.Doc.Documents;
using Spire.Doc.Fields;
namespace InsertComment
{
class Program
{
static void Main(string[] args)
{
//Load Document
Document document = new Document();
document.LoadFromFile(@"E:\work\Documents\WordDocuments\Humor Them.docx");
//Get Paragraph to Insert Comment
Section section = document.Sections[0];
Paragraph paragraph = section.Paragraphs[2];
//Insert Comment
string str = "This paragraph presents the first example to Humor Them.";
Comment comment = paragraph.AppendComment(str);
comment.Format.Author = "E-iceblue";
comment.Format.Initial = "CM";
//Save Document
document.SaveToFile("comments.docx", FileFormat.Docx2010);
System.Diagnostics.Process.Start("comments.docx");
}
}
}
[VB.NET]
Imports Spire.Doc
Imports Spire.Doc.Documents
Imports Spire.Doc.Fields
Namespace InsertComment
Class Program
Private Shared Sub Main(args As String())
'Load Document
Dim document As New Document()
document.LoadFromFile("E:\work\Documents\WordDocuments\Humor Them.docx")
'Get Paragraph to Insert Comment
Dim section As Section = document.Sections(0)
Dim paragraph As Paragraph = section.Paragraphs(2)
'Insert Comment
Dim str As String = "This paragraph presents the first example to Humor Them."
Dim comment As Comment = paragraph.AppendComment(str)
comment.Format.Author = "E-iceblue"
comment.Format.Initial = "CM"
'Save Document
document.SaveToFile("comments.docx", FileFormat.Docx2010)
System.Diagnostics.Process.Start("comments.docx")
End Sub
End Class
End Namespace
Spire.Doc 是一個 Microsoft Word 組件,它使用戶能夠直接執行范圍廣泛的 Word 文檔處理任務,例如在 WPF、.NET 和 Silverlight 中生成、讀取、寫入和修改 Word 文檔。
以上便是在 C#、VB.NET 中插入 Word 注釋,如果您有其他問題也可以繼續瀏覽本系列文章,獲取相關教程,你還可以給我留言或者加入我們的官方技術交流群。
歡迎下載|體驗更多E-iceblue產品
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@ke049m.cn