2016-05-24 2 views
1

Als ich in Benutzung war, hatte das dsoframer Operationswort ein Problem.wie man Wortkommentar in C# code editiert (benutze dsoframer)

kann ich einen Kommentar von Code wie dieses Add

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

aber wie der Kommentar Inhalt aktualisieren? Ich kann keine Funktion dafür finden!

word.Comments[ctIndex].. 

Antwort

1

lesen:

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

Vergessen Sie nicht, es als Antwort zu markieren, wenn dies Ihr Problem lösen ^^

schreiben:

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

By the way, Sie wissen Wie bekomme ich die Seitenzahl für einen Kommentar? –