C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

Spellchecking non-text box controls (mshtml.HtmlDocument)

rated by 0 users
This post has 2 Replies | 2 Followers

Not Ranked
Posts 4
ChrisD Posted: Wed, May 14 2008 12:29 PM

This is probably quite simple, but I can't seem to figure out how to pass the reference or even if it's possible. I've banged together a quick and dirty HTML editor using design mode on an mshtml.HtmlDocument object and I'd like to know if I can spell check within that instead of the traditional text box control as seen in the examples. I made a messy work around that involves a hidden text box that gets updated on every change, but that only works for the "all at once", and not the "as you type" spell checking (and only works on the InnerText as opposed to InnerHTML, since every HTML tag of course shows up as a typo).

 I think it's possible, but I have been reading about how much of a pain it is to get the mshtml object to play ball with traditional .Net references, and was hoping someone here had an idea of where to start.

Top 10 Contributor
Posts 2,707

The C1SpellChecker supports this type of extensibility through two interfaces:

  • ISpellCheckableEditor: This is a simple interface that enables modal (dialog-based) spell-checking.
  • ISpellCheckableRichEditor: A more complex interface that enables as-you-type spell-checking.

The SpellGrid sample shows how you can implement the ISpellCheckableEditor and use that to spell-check a grid. It would be very easy to do the same and support an mshtml-based editor (we should probably create a sample for that...)

However, I think it would be pretty hard to implement the ISpellCheckableRichEditor on mshtml. That would be required for as-you-type checking.

Top 10 Contributor
Posts 2,707
For the record, we have added support for spell-checking editors based on the WebBrowser control. This is from the readme: ========================================================================================= C1.Win.C1SpellChecker.2.dll Build Number 2.0.20092.51 Build Date: June 17, 2009 ========================================================================================= Enhancements/Documentation/Behavior Changes ------------------------------------------- * Added support for editors based on the WebBrowser class. The support includes underlining errors with red-wavy underlines as you type, with suggestions in context-sensitive menus, and also the dialog-based modal spell-check. The methods used are the same as the ones used with TextBoxBase controls, except there are overloads that take a WebBrowser control instead of a TextBoxBase: - SetActiveSpellChecking turns as-you-type spell checking on or off, and - CheckControl performs a dialog-based modal check of the text in the control.
Page 1 of 1 (3 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.