I wanna do a application with C# ; it will count correct words and wrong words in a text and show me it ... there is a feature in MS Word .. So how can i use this feature in C# if its possible ? (in Turkish language).
+2
A:
You can add a reference to Microsoft Word x.0 Object Library. Check out this MSDN article for information: http://msdn.microsoft.com/en-us/library/15s06t57(VS.80).aspx.
Once you have added the reference you should then be able to use the Word.Application object. It would look something like this (untested code!!).
using Word;
public void checkspelling(string text)
{
Word.Application app = new Word.Application();
object template=Missing.Value;
object newTemplate=Missing.Value;
object documentType=Missing.Value;
object visible=true;
object optional = Missing.Value;
_Document doc = app.Documents.Add(ref template,
ref newTemplate, ref documentType, ref visible);
doc.Words.First.InsertBefore(text);
Word.ProofreadingErrors errors = doc.SpellingErrors;
ecount = errors.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);
if (ecount == 0)
{
// no errors
}
else
{
// errros
}
}
NJChim
2009-06-10 14:35:23
A:
http://www.codeproject.com/KB/cs/spellcheckdemo.aspx
Here is an additional older example from CodeProject.
JTA
2009-06-10 14:37:48
+1
A:
I don't thing it is a good idea to use the MS Office spell checkers. There are several open source libraries out there you can use. One of them is NHunspell, the .NET Version of the open office spell checker Hunspell. It works with the open office directories and yo got support for a lot of languages.
Thomas Maierhofer
2009-08-31 12:22:43