TX Spell .NET is a very powerful spell checking engine with a tight integration into the document editors from Text Control including ASP.NET, Angular and Windows Forms. It provides fully-featured UI elements including dialog boxes and context menus when connected to a Text Control instance.

Non-Visual Spell Engine

But the product also includes the non-visual component TXSpell TX Spell .NET for Windows Forms
Proofing Namespace
TXSpell Class
The TXSpell class provides properties and methods with spell checking features.
that can be used for background processing. This sample shows how to use this class to create a spell checking Web API using ASP.NET Core.

Implementing the Web API Controller

The sample implements the Web API controller SpellController:

Loading...

This controller implements 4 endpoints:

  • Check
  • CreateSuggestions
  • CreateSynonyms
  • DetectLanguageScopes

The following code shows the implementation of the Check method that accepts the Text to be checked and an optional language identifier:

Loading...

In the method Check, a new instance of the spell checker is created and a dictionary is loaded and added to the available dictionaries using the Dictionaries.Add TX Spell .NET for Windows Forms
Proofing Namespace
DictionaryCollection Class
Add Method
Adds objects of the type Dictionary to the collection and validates them for spell checking and suggestion operations.
method.

The given Text is checked using the Check TX Spell .NET for Windows Forms
Proofing Namespace
TXSpell Class
Check Method
Checks text for spelling errors and fills the IncorrectWordCollection at TXSpell.IncorrectWords with all incorrect words.
method and the results are returned as a list of IncorrectWords.

Calling from JavaScript

On the JavaScript side, the endpoint is called using a jQuery ajax call:

Loading...
Loading...

The spell checking functions are encapsulated in a private scope and exposed as properties in the TXSpell JavaScript object. This way, the check method can be called like this in the sample:

Loading...

On a button click, the function checkText is called:

Loading...

Demo Screenshots

The following screenshot shows the sample after the Check button has been clicked:

Spell Checking

Create Suggestions:

Spell Checking

Create Synonyms:

Spell Checking

Detect Languages:

Spell Checking

Download the sample project and test this on your own.