Toshal Mokadam
Toshal Mokadam

Reputation: 63

SpellCheck in c#

I am writing a c# code for spellchecking using Word.dll. I have used the following site as reference: http://www.codeproject.com/Articles/2469/SpellCheck-net-spell-checking-parsing-using-C

But i am getting an error: "The type or namespace name 'Word' could not be found (are you missing a using directive or an assembly reference?)"

The code that I am using is:

    SpellCheck word = new SpellCheck();

    bool status = false;
    string s = "youes";

    Console.WriteLine("Checking for word : " + s );

    // check to see if the word is not correct  
    // return the bool (true|false)
    status = word.CheckSpelling(s);

    if (status == false)
    {
        Console.WriteLine("This word is misspelled : " + s);
        Console.WriteLine("Here are some suggestions");
        Console.WriteLine("-------------------------");

        foreach( string suggestion in word.GetSpellingSuggestions(s) ) 
        {
            System.Console.WriteLine( suggestion ); 
        }
    }
    else if (status == true)
    {
        Console.WriteLine("This word is correct : " + s );
    }

I just want to know how can I make it work?

Upvotes: 3

Views: 2068

Answers (3)

Alex
Alex

Reputation: 6159

I think you should add refernce to Micorsoft.Office.Interop.Word under .Net

Upvotes: 0

Onur
Onur

Reputation: 599

You should download the source code. There is a file named Word.cs, and you should add that file to your project. Word namespace and SpellCheck class are defined in that file.

Upvotes: 1

Artem Koshelev
Artem Koshelev

Reputation: 10604

Create a new class in your solution and call it Word.cs. Open the “Browse Code” tab in the article at CodeProject, click Word.cs to view it's source code. Copy and paste it to your Word.cs file.

Upvotes: 1

Related Questions