1

When I was in use the dsoframer operation word had a problem.

i can add a comment by code like this

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

but how to update the comment content? I can't find any function to do this!

word.Comments[ctIndex]..
xwei_chen
  • 65
  • 6

1 Answers1

1

Read:

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

Do not forget to mark it as answer if this solve your problem ^^

Write:

foreach (Comment comment in comments)
      {
        comment.Range.Text = "Write a new text here";
      }
Bassam Alugili
  • 16,345
  • 7
  • 52
  • 70