I created a plugin for Word over 2 years ago. After the new version of Word 2016 on Windows. I am having some problems creating comments.
How to recreate the problem:
Create a simple addin project in Visual Studio. Add a feed to the project. Add a button to the feed, which will create a comment on the click.
Run addin. In Word 2016, under a tab overview. Turn off the display of comments and set the markup to simple markup.
Now add two comments using the button in the plugin. Then add a comment between the two comments with the built-in comment system in the word. Re-enable commenting again in the Overview section. Now add a comment at the end of the document. Now you should see that the new comment is empty, and the text is added to the first comment of the document.
If you include comments on an impression before adding any comments to the document, everything should work as expected. If you recreate higher in an older version than Word 2016, everything will work.
My code
Here is my main code for creating a comment
private void button2_Click(object sender, RibbonControlEventArgs e) { Document oDocument = Globals.ThisAddIn.Application.ActiveDocument; Selection curSel = Globals.ThisAddIn.Application.Selection; oDocument.Comments.Add(curSel.Range, "My comment"); }
I hope someone can help with this problem. I have now tried everything: from changing the version of vsto and creating another project with different code.
source share