Word has no GetGrammarSuggestions equivalent to GetSpellingSuggestions
How to get a list of suggested corrections for Word grammar errors
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);
}
--------------------------------------