如何在 C# 代码中编辑单词注释(使用 dsoframer)

how to edit word comment in c# code (use dsoframer)

我在使用dsoframer的时候操作word有问题

我可以像这样通过代码添加评论

   Microsoft.Office.Interop.Word.Comment cm = 
word.Comments.Add(word.Application.Selection.Range, "test");
int ctIndex = cm.Index;

但是如何更新评论内容呢?我找不到任何功能来执行此操作!

word.Comments[ctIndex]..

阅读:

var comments = wordApp.ActiveDocument.Comments;
    foreach (Comment comment in comments)
    {
      var commentText = comment.Range.Text;
      var scopeTxt = comment.Scope.Text;
        Console.WriteLine(commentText);
    }

如果这解决了你的问题,别忘了将其标记为答案^^

写入:

foreach (Comment comment in comments)
      {
        comment.Range.Text = "Write a new text here";
      }