How to get a list of suggested corrections for Word grammar errors

Cavalier King Charles Spaniel 1 Reputation point
2022-09-22T13:26:22.743+00:00

I have developed an application in C# that utilizes Word's "Spelling and Grammar".

In MSI version of Word, you can check for spelling and grammatical errors and get a list of possible corrections. However, the C2R version can check grammatical errors, but cannot obtain a correction candidate list.
How do I get a suggested list of grammatical errors?

■ Methods implemented by the application
・Spelling error
   Application.GetSpellingSuggestions
   →You can get the correction candidate list

· Grammar error
   CommandBars["Grammar"].Controls
   →Because of the recognition that there is no dedicated method, the one with the ID "0" is extracted from the control and acquired.
    There is no problem with the MSI version, but it cannot be acquired with the C2R version.
 

■ CommandBars["Grammar"].Controls Source code details

--------------------------------------

Microsoft.Office.Core.CommandBarControls cmdBarCtls =  
    this.myDoc.CommandBars["Grammar"].Controls;           
if (cmdBarCtls == null) {                                 
    return false;                                         
}  
 
List<string> reviseList = res.ReviseList;                 
foreach (Microsoft.Office.Core.CommandBarControl ctrl in cmdBarCtls) {  
                                       
    if (ctrl.Id == 0) {                
    reviseList.Add(ctrl.Caption);      
    }  

--------------------------------------

Microsoft 365 and Office | Development | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. macropod 91 Reputation points
    2022-09-22T23:29:53.42+00:00

    Word has no GetGrammarSuggestions equivalent to GetSpellingSuggestions


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.