Solved

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

Posted on 2015-01-14
5
206 Views
Last Modified: 2015-01-16
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.
0
Comment
Question by:stevenschulman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 40
ID: 40551693
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.
0
 

Author Comment

by:stevenschulman
ID: 40552558
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.
0
 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 500 total points
ID: 40553003
Word automation has been designed to create or modify documents through code, and it provides a lot of classes to do so. But it was not designed to react to user actions.

If you look at the list of events provided by Microsoft, you can easily see that they almost all deal with global operations on the document or containers such as controls, bookmarks and XML elements.

If Microsoft does not provide the necessary event, I do not see how one could write a library that does so. Events need to be raised in the software where they happen. You cannot add one except in the original source code.

You might be better off using something else than Word for your purpose. There are a lot of text editors components available for .NET. You might want to write your application in a Windows Form or ASP application that use one of these. Most of them are costly however.
0
 

Author Closing Comment

by:stevenschulman
ID: 40554296
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.
0
 
LVL 40
ID: 40554317
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.
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

710 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question