C# 如何回复Word批注
此条经验将介绍如何通过C# 来回复Word批注。
工具/原料
Free Spire.Doc for .NET 6.3(社区版)
Visual Studio
dll引用
1、在E-iceblue官网或者Nuget网站上下载Free Spire.Doc for .NET的安装包后,注意在编辑代码时,添加引用Spire.Doc.dll到程序。dll文件可在安装路径下的Bin文件夹中获取。
C#(供参考)
1、using Spire.Doc;using Spire.Doc.Fields;namespace ReplyComment_Doc{ class Program { static void Main(string[] args) { //实例化Document类,加载文件 Document doc = new Document(); doc.LoadFromFile("test.docx"); //获取第一个批注 Comment comment = doc.Comments[0]; //实例化Comment类,添加批注回复作者以及回复内容 Comment replyComment = new Comment(doc); replyComment.Format.Author = "Adam"; replyComment.Body.AddParagraph().AppendText("这条批注内容请再丰富一下,内容有些单调"); comment.ReplyToComment(replyComment); //保存文件并打开 doc.SaveToFile("ReplyToComment.docx", FileFormat.Docx2013); System.Diagnostics.Process.Start("ReplyToComment.docx"); } }}
2、批注回复效果: