Link to home
Start Free TrialLog in
Avatar of stevenschulman
stevenschulmanFlag for United States of America

asked on

Add in for MS Word to function like spell or grammar checker

I would like to write an add in for Microsoft Word that functions similarly to spell or grammar checker. It should monitor the text as it is entered. If conditions I will test for are met then it should mark the word with a squiggly/wavy underline which does not print.
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Not an easy task at all.

Word does not give you access to objects, methods or properties that would create the wiggly (the name Microsoft use for these wavy lines). Trying to create them graphically either as a picture that you imbed in the document or as some kind of overlay would also be a plain, if not possible at all, because Word does not provide you with metrics as to the position of the text on the screen.

I was curious and tried something. Simply add a hidden character in the text that would trigger a wiggly. It does not work however, because Word disregard hidden characters when evaluating the spelling of a word.

What are these conditions?

The best thing I can know of is to mark the text with the wavy underline that is available in the font properties (.Underline = wdUnderlineWavy). Then, provide your own printing button and remove these underlines or set their color to white (.UnderlineColor = wdColorWhite) before sending the document to the printer.

You might also consider doing something similar with shading. This would enable you to use color to attract the attention.

Or use animation such as .Animation = wdAnimationBlinkingBackground. Animations are not looking very nice on the screen, but they do attract the attention and do not print.
Avatar of stevenschulman

ASKER

Thank you very much. Do you have any suggestions about the first part of the question? That is, I want the response to happen as the user is typing, For spell checker it happens when you enter the space indicating that the word is complete. Similarly, it will automatically capitalize the first word after a period.

Is there no .net library or c# code that supports this? I am open to alternatives.

Again, thank you.
ASKER CERTIFIED SOLUTION
Avatar of Jacques Bourgeois (James Burger)
Jacques Bourgeois (James Burger)
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I suppose "no" is an answer, too. It is interesting that Microsoft can produce a spell checker and a grammar checker, but blocks the functionality from others. That doesn't make sense to me, but I guess whatever is, is.
They do not block the functionnality of the spell checker. You can use the spell checker itself in your own applications, at least up to Office 2003 (http://msdn.microsoft.com/en-us/library/aa537153(v=office.11).aspx).

It's the user interaction with the text, including typing, that is limited.

Do not forget that Word is an old application. VBA did not exist up to Word 6.0. It was probably written in C orginally, not in C++. So no classes. And a word processor of that scale is a very complex piece of software. They would probably have to rewrite it from scratch if they made everything accessible when they introduced automation in the middle of the 90's. So they probably decided to do it for the big pièces, but left the inner workings as they were.