Word 2016 addin comments not creating new
Asked Answered
P

0

11

I created a plugin for Word for more than 2 years ago. After the new Word version 2016 on Windows. I'm experience some problems with creating comments.

How to recreate the problem:

Create a simple word addin project in Visual Studio. Add a ribbon to the project. Add a button to the ribbon that on click create a comment.

Run the addin. In Word 2016 under the tab review. Turn show comments off and set markup to simple markup.

Now add two comments with the button in the plugin. Then add a comment between the two comments with the built in comment system in word. Turn on show comments again under the tab Review. Now add a comment to the end of the document. Now you should see the new comment is empty and the text is added to the first comment of the document.

If you turn on show comments before you add any comments to the document everything should work as expected. If you recreate the above in a older version than Word 2016 everything works.

My code

Here is my basic code for creating the 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 version of the vsto and creating different project with different code.

Phrygia answered 18/10, 2016 at 13:23 Comment(5)
I don't have an answer for you but I just wanted to let you know that your question helped me solve my own problem. Thanks!Mn
@TerenceJohnson you might need to raise a Microsoft support case for this.Quartic
As Jeremy said - if this is a change in behvaior between office versions you should raise a MS support case however if you already know the workaround why not call - ActiveWindow.View.ShowComments = True when you initialise or add your first comment?Bisect
The customer choose to skip support for the Word 2016. And I have no longer access to the project.Phrygia
@Bisect The workaround does not seem completely reliable. We do make that call in our code and the users still experience this issue.Vermiculate

© 2022 - 2024 — McMap. All rights reserved.