qme
qme

Reputation: 279

Microsoft Office Professional Plus 2019 Spellchecker dialog in a windows form application, the "Not in Dictionary" text area is empty and disabled?

I have Microsoft Office Professional Plus 2019 installed in Windows 10 Enterprise.

I used "CheckSpelling" method in calling a spellchecker dialog in a c# windows form application, however, the "Not in Dictionary" text area is empty and disabled (which should not be!). But when I was using Office 2016, "Not in Dictionary" was not empty and disabled. Do you know why it is empty and disabled? What is the solution or workaround for this?

Below is the c# code I used in a windows form application for opening a spell checker dialog of MS Word and image. I also tried using Office 16 interop word DLL but it is still the same issue.

Application wordApp = new Application();
object template = Missing.Value;
object newTemplate = Missing.Value;
object documentType = Missing.Value;
object visible = true; 
object optional = Missing.Value;
_Document doc = wordApp.Documents.Add(ref template, ref newTemplate, ref documentType, ref visible);
doc.Words.First.InsertBefore(input);
ProofreadingErrors pe = doc.SpellingErrors;
int errorCount = pe.Count;
doc.CheckSpelling(ref optional, ref optional, ref optional, ref optional,
                    ref optional, ref optional, ref optional, ref optional, ref optional,
                    ref optional, ref optional, ref optional);

Thank you.

enter image description here

Upvotes: 0

Views: 258

Answers (2)

VaultBoy13
VaultBoy13

Reputation: 9

When I keep Word minimized so that only the spelling and grammar check is visible the box is disabled.

There's two workarounds:

  1. Set the window state to Normal or Maximized before calling the spelling or grammar check.
  2. Have the user click on the Options button and then cancel out of the Options window. This refreshes the dialog and corrects the issue.

Here's a better workaround after spending more time with it:

  1. Store the height and width of Word so that you can restore it later.
  2. Set the height and width of Word to something small (e.g.; 10).
  3. Set the position of Word to the top-left (0, 0).
  4. Restore the Word window so that it's displayed on the screen. It will only be a small bar in the top-left of the screen.
  5. Run the spellcheck.
  6. Hide Word (or minimize it)
  7. Restore the height and width of Word to their original size.

You could move it to a different corner of the screen to try to better hide it. But, the Word window has to be on the screen. If you restore it to a location that's off-screen, then the bug is still there.

Upvotes: 0

HBBob
HBBob

Reputation: 11

For me when I set the word app to visible=true it worked as expected.

Upvotes: 0

Related Questions