Got more questions? Find advice on: SQL | XML | Regular Expressions | Windows
in Search
Welcome to AspAdvice Sign in | Join | Help

TX Text Control

News and interesting articles about the word processing component TX Text Control.

Using TX Spell .NET in ASP.NET

Both versions of TX Spell .NET (Windows Forms and WPF) ship with a non-visual component: TXTextControl.Proofing.TXSpell. This class can be used for ASP.NET Web Services, Web Applications or even Windows Services.

In order to create an instance of this pure spell checking engine, the following code is required:

TXTextControl.Proofing.TXSpell txSpell1 = new TXTextControl.Proofing.TXSpell();
txSpell1.Create();


The Create method initializes the resources of a newly instantiated TXSpell object.

After an instance has been created, the Check method can be called to check the spelling of single words, a paragraph or a whole text. In this sample application, the content of an ASP.NET TextBox should be validated using the ServerValidate event of a CustomValidator. Using this validator object is a very smart way to validate user input and to display custom error messages when the input could not be validated. The following code is used to validate the content using TX Spell .NET:

protected void CustomValidator1_ServerValidate
(object source, ServerValidateEventArgs args)
{
TXTextControl.Proofing.TXSpell txSpell1 =
new TXTextControl.Proofing.TXSpell();

txSpell1.Create();

txSpell1.Check(args.Value);

if (txSpell1.IncorrectWords.Count == 0)
args.IsValid = true;
else
{
args.IsValid = false;

string sErrorMessage = "Misspelled.";

txSpell1.CreateSuggestions(args.Value);

if (txSpell1.Suggestions.Count > 0)
sErrorMessage += " Do you mean '" +
txSpell1.Suggestions[0].Text + "'?";

CustomValidator1.ErrorMessage = sErrorMessage;
}
}


In a first step, the input string is checked for spelling errors. If the word is misspelled, TX Spell .NET is used to create proper suggestions that are suggested to the user in the custom validation error message.

Screenshot

This is just one way of using TX Spell .NET in a Web Application. How would you make use of it? here. Visual Studio 2010 and a trial version of TX Spell .NET is required.


About TX Text Control:

TX Text Control was originally released in 1991, since then more than 50,000 copies have been sold. Starting off as a single, small DLL, TX Text Control has made its way through 16-bit DLL and VBX versions to today‘s Enterprise edition with its .NET and ActiveX components. The recent addition to the family, TX Text Control .NET Server, offers all of TX Text Control advanced word processing functionality in an easy-to-use server-side .NET component. Customers benefit from these years of experience, large user base, and at the same time, appreciate developing with a mature, reliable product.

Contact Informations:

support@textcontrol.com

North & South America:
Phone: +1 704-370-0110
Phone: +1 877-462-4772 (toll free)

Europe:
Phone: +49 (0)421 42 70 67 10

Asia Pacific:
Phone: +886 2-2797-8508
Sponsor
Published Wednesday, November 30, 2011 5:41 AM by Christopher Krause

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Enter the code you see below

Submit

This Blog

Syndication