翻譯|使用教程|編輯:胡濤|2022-12-13 10:11:33.707|閱讀 218 次
概述:本文將分享如何在 C#、VB.NET 中回復(fù) Word 中的評(píng)論,歡迎查閱~
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Spire.Doc for .NET是一款專門對(duì) Word 文檔進(jìn)行操作的 .NET 類庫。在于幫助開發(fā)人員無需安裝 Microsoft Word情況下,輕松快捷高效地創(chuàng)建、編輯、轉(zhuǎn)換和打印 Microsoft Word 文檔。擁有近10年專業(yè)開發(fā)經(jīng)驗(yàn)Spire系列辦公文檔開發(fā)工具,專注于創(chuàng)建、編輯、轉(zhuǎn)換和打印Word/PDF/Excel等格式文件處理,小巧便捷。
在 Word 2013 及更高版本中,您可以回復(fù)批注,以便更輕松地了解整個(gè)對(duì)話。Spire.Doc 還允許程序員通過 ReplyToComment 方法插入評(píng)論作為對(duì)所選評(píng)論的回復(fù)。
第 1 步:創(chuàng)建一個(gè) Document 對(duì)象并加載一個(gè)包含評(píng)論的 Word 文檔。
Document doc = new Document(); doc.LoadFromFile("Comment.docx");
第 2 步:獲取第一條評(píng)論。
Comment comment = doc.Comments[0];
第 3 步:創(chuàng)建新評(píng)論并指定作者和內(nèi)容。
Comment replyComment = new Comment(doc); replyComment.Format.Author = "Adam"; replyComment.Body.AddParagraph().AppendText("Exactly.");
第 4 步:將新評(píng)論添加為對(duì)所選評(píng)論的回復(fù)。
comment.ReplyToComment(replyComment);
第 5 步:保存到文件。
doc.SaveToFile("ReplyToComment.docx", FileFormat.Docx2013);
完整代碼:
[C#]
using Spire.Doc; using Spire.Doc.Fields; namespace ReplyComment { class Program { static void Main(string[] args) { Document doc = new Document(); doc.LoadFromFile("Comment.docx"); Comment comment = doc.Comments[0]; Comment replyComment = new Comment(doc); replyComment.Format.Author = "Adam"; replyComment.Body.AddParagraph().AppendText("Exactly."); comment.ReplyToComment(replyComment); doc.SaveToFile("ReplyToComment.docx", FileFormat.Docx2013); } } }
[VB.NET]
Imports Spire.Doc Imports Spire.Doc.Fields Namespace ReplyComment Class Program Private Shared Sub Main(args As String()) Dim doc As New Document() doc.LoadFromFile("Comment.docx") Dim comment As Comment = doc.Comments(0) Dim replyComment As New Comment(doc) replyComment.Format.Author = "Adam" replyComment.Body.AddParagraph().AppendText("Exactly.") comment.ReplyToComment(replyComment) doc.SaveToFile("ReplyToComment.docx", FileFormat.Docx2013) End Sub End Class End Namespace
以上便是在C#、VB.NET如何在Word的評(píng)論中插入圖片,如果您有其他問題也可以繼續(xù)瀏覽本系列文章,獲取相關(guān)教程,你還可以給我留言或者加入我們的官方技術(shù)交流群。
歡迎下載|體驗(yàn)更多E-iceblue產(chǎn)品
獲取更多信息請(qǐng)咨詢 ;技術(shù)交流Q群(767755948)
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn