Vexen Crabtree 2015

vexen

Vexen Crabtree's Live Journal

Sociology, Theology, Anti-Religion and Exploration: Forcing Humanity Forwards


Previous Entry Share Next Entry
Vexen Crabtree 2015
vexen

Spelling mistakes... can I import MSWord's spellchecker into my own app?

In 1992, my English teacher, Mrs. Gilliam Tomlinson, said on my report:

"[Vexen] is quiet in class, but is an industrious worker. His imagination is easily fired and he writes with real flair, using good vocabulary to express himself. He writes at length and presents his work well. Obviously he thinks about things and has an individual mind. His weakness is spelling. I want [Vexen] to use the dictionary, to check spellings and to check his final draft after completion"

This weekend I've been editting and reformatting some old pages written in 1998 and 1999 that I haven't looked at for many years... and keep finding spelling mistakes. These have been on my website for a good six or seven years.

Why do I do it to myself? And more importantly, does anyone (any programmer...) know if I can use Microsoft Word's spellchecker in my own applications? Basically, call a MSWord_Spellcheck.dll and pass it the reference for a textbox, and have it do all the business?

Failing that, anyone know a dictionary library I can download and #include to add a spellcheck to (my version of) notepad?

  • 1
I don't know about MS Word's spellchecker, but you can use the open-ssource spellcheckers in your own apps with a bit of programming.

Sounds like an idea...

Yes you can. Lemme see if I can knock up something....

Oh, I would be using Delphi to knock something up. If that's a problem, let me know, I might be able to stretch to using C#....

Depends... my notepad program is written in VB6 (yeah yeah I know, sue me, but it's easy), it's an MDI version of notepad with Batches of files grouped together, favorites, optional encryption&password for files, etc, I think it would end up meaning work for you to write a custom library that interfaces usefully! I looking for a freeware app (I've been told they're out there) that I can code in.

I think when you mention Delphi you're considering doing a whole GUI (is delphi good as a low level language, too?, I don't know), when what I need is really just something I can call

#include [DLL with SpellCheck functions in]

SpellCheckText obTextBox, obStartIndex, obEndIndex, obOptionsFlags


And have it just select words it thinks are wrong, and bring up a multiple choice popup (not modal) that allows me to copy-paste correct spellings in.

Oh, you just hook into Word itself. It's quite easy. What version of Word are you using?

Sorry dude. I'm in the same boat. I'm a bit dyslexic and ambidextrous but write with my "sinister" hand. I've always rated intelligent but spell like a kid.

Typically what I do is Ctrl-A, Ctrl-C, Ctrl-V into Word, write what I want and then copy and paste back into the text box I'm going to post. Its a bit more work, but I don't have 'much' of a choice. I can read anything but spelling doesn't come naturally to me.


The Vampire
LOGOS

Yes, I know you were writing about your site, not you, but anyway...


;-)


LOGOS

I do that too... not with LJ comments, but with most other text... copy into Word, then spellcheck the copy and correct the original. Simply necessary.

hey ... this is over a year old, i know
if you're dead set on using MSWord (and haven't already found a solution), the easiest way i know is to use the built in office automation ... which is basically just vba script you can dump into an asp file

you could add it the website itself as long as msword is installed on the server, so users could check their spelling when leaving posts, etc.

DIM objWord
DIM objDoc

'starts word
SET objWord = CreateObject("Word.Application")

'options to hide the word app
objWord.WindowState = 2
objWord.Visible = false
objWord.Options.SuggestSpellingCorrections = true

'create a new document
objDoc = objWord.Documents.Add

'now just dump what ever text you want to check into the document
objDoc.Content = strStringToCheck

'get word count
intWordCount = objDoc.Words.Count

'run the spell check and catch the number of spelling errors
intErrorCount = objDoc.SpellingErrors.Count

'now do something like this ...

if(intErrorCount = 0)then
strMessage = "No spelling errors found."
else
'errors found, suggest corrections
'#################################
i = 1
while(i < intErrorCount)
if(objDoc.Words(i).SpellingErrors.Count > 0)then
'word is mispelled
'##################
if(objDoc.Words(i).GetSpellingSuggestions.Count > 0)then
'there were suggested corrections found in word's dictionary
'###########################################################
...
...
...then however you want to handle the corrections...the suggested corrections are in "objDoc.Words(i).GetSpellingSuggestions.Item(x).Name" where 'x' is the number of suggested corrections found...so you can loop through the individual corrections for each misspelled word if you wanted to put them, say, in a drop down list or something where the user could select a correction that way. Or,
"objDoc.Words(i).GetSpellingSuggestions.Item(1).Name" (note the '1' in Item(1)...) is always Word's "closest match" so you could just auto place that in for each mispelled word (then you wouldn't have to loop through everything, but you'd have to trust word alot) just replace the value of Words(i) with Item(1).Name ... anyway when everything's done, close out the objects like this...

objDoc.Close false 'false == do not save the word doc
objWord.Quit true 'close word
set objDoc = nothing
set objWord = nothing

and that's it.

this is just as easily done in any win32 app ... or .net app (web, or win32 ... a couple things are a bit different with .net it's probably a little easier, too ... just link to the com object ... all this you can easily look them up on msdn.com) or you find a crap load of user defined apps and objects if you google it

anyway ... there's an outdated solution to an outdated request

  • 1
?

Log in