在 Word 2013 及更高版本中,您可以回复批注,以便更轻松地了解整个对话。Spire.Doc 还允许程序员通过 ReplyToComment 方法插入评论作为对所选评论的回复。
第 1 步:创建一个 Document 对象并加载一个包含评论的 Word 文档。
Document doc = new Document();doc.LoadFromFile("Comment.docx");
第 2 步:获取第一条评论。
Comment comment = doc.Comments[0];
Comment replyComment = new Comment(doc);replyComment.Format.Author = "Adam";replyComment.Body.AddParagraph().AppendText("Exactly.");
第 4 步:将新评论添加为对所选评论的回复。
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.DocImports Spire.Doc.FieldsNamespace ReplyCommentClass ProgramPrivate 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 SubEnd ClassEnd Namespace
以上便是在C#、VB.NET如何在Word的评论中插入图片,如果您有其他问题也可以继续浏览本系列文章,获取相关教程,你还可以给我留言或者加入我们的官方技术交流群。
欢迎下载|体验更多E-iceblue产品
获取更多信息请咨询在线客服 ;
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!