TX Spell .NET for WPF

TXSpell Class

Class
Namespace
TXTextControl.Proofing
Package
TXTextControl.TXSpell.WPF.SDK from the private NuGet feed or Text Control Offline Packages
Assembly
TXSpell.dll
Install
dotnet add package TXTextControl.TXSpell.WPF.SDK .NET 8 and later. For .NET Framework, reference TXSpell.dll from the setup.
Also in
TXTextControl.TXSpell.Core.SDK as TXSpell.dll

Description

The TXSpell class provides properties and methods with spell checking features. It is particularly suitable for spell checking tasks, where no text components are required. This could be spell checking text or getting suggestions for an incorrect word. Spell checking tasks with text components can be handled by using the TXSpellChecker class, if the text component provides an interface to connect it with the TXSpellChecker component. The following describes the properties, methods and events defined through the TXSpell class.

Syntax

public sealed class TXSpell

Examples

The following example creates a TXSpell instance and configures its dictionaries directory path setting for a document workflow.

TXTextControl.Proofing.TXSpell tXSpell = new();
tXSpell.DictionariesDirectoryPath = "document.docx";

Members

Constructors

ConstructorDescription
TXSpellInitializes a new instance of the TXSpell class.

Properties

PropertyDescription
AvailableDictionariesGets a list of all available dictionaries of the default dictionary folder.
AvailableHyphenationListsGets a list of all available hyphenation lists of the default hyphenation lists folder.
AvailableSynonymListsGets a list of all available synonym lists of the default synonym lists folder.
DetectableLanguageScopesGets or sets a list of all languages that are used to detect language scopes in a text.
DictionariesGets a collection of all added and validated dictionaries. The property's value is an object of type DictionaryCollection.
DictionariesDirectoryPathGets or sets the path to the default dictionaries folder. The default value is "(Auto)" that determines the Dictionaries directory at the application's root folder or in the \Assembly\ subdirectory in the development machine's TX Spell .NET installation directory.
HyphenationLanguageGets or sets the name of a hyphenation list that is located at the default hyphenation lists folder. When using the HyphenationLanguage property, the Hyphenation.IsSelectedAsDefault property of the chosen hyphenation list is set to true. The default value is "(Auto)".
HyphenationListsGets a collection of all added hyphenation dictionaries. The property's value is an object of type HyphenationListCollection.
HyphenationListsDirectoryPathGets or sets the path to the default hyphenation lists folder. The default value is "(Auto)" that determines the HyphenationLists directory at the application's root folder or in the \Assembly\ subdirectory in the development machine's TX Spell .NET installation directory.
IgnoreCaseGets or sets a value of type IgnoreCaseSettings determining whether the case of a word is ignored or not during spell checking. The default value is AllUpper | WordBeginUpper.
IgnoreWordGets or sets a value of type IgnoreWordSettings determining when a word should not be spell checked. The default value is InUpperCase | IsEmail | IsURL | WithNumbers.
IncorrectWordsGets a collection of all incorrect words that were detected by the last call of the TXSpell.Check method. The property's value is an object of the type IncorrectWordCollection.
LanguageGets or sets the name of a dictionary that is located at the default dictionary folder. When using the Language property, the Dictionary.IsSelectedAsDefault property of the chosen dictionary is set to true. The default value is "(Auto)".
LanguageRecognitionDirectoryPathGets or sets the path to the language recognition folder that provides the languageRecognition.resources file which is required to detect language scopes in a text. The default value is "(Auto)" that determines the LanguageRecognition directory at the application's root folder or in the \Assembly\ subdirectory in the development machine's TX Spell .NET installation directory.
LanguageScopesGets a collection of all detected language scopes. The property's value is an object of type LanguageScopeCollection.
SpellingCorrectionUIProviderGets an object of type SpellingCorrectionUIProvider to provide methods and properties for constructing a spelling correction user interface.
SuggestionsGets a collection of suggestions that were created by the last call of the TXSpell.CreateSuggestions method. The property's value is an object of type SuggestionCollection.
SynonymLanguageGets or sets the name of a synonym list that is located at the default synonym lists folder. When using the SynonymLanguage property, the SynonymList.IsSelectedAsDefault property of the selected synonym list is set to true. The default value is "(Auto)".
SynonymListsGets a collection of all added synonym lists. The property's value is an object of type SynonymListCollection.
SynonymListsDirectoryPathGets or sets the path to the default synonym lists folder. The default value is "(Auto)" that determines the SynonymLists directory at the application's root folder or in the \Assembly\ subdirectory in the development machine's TX Spell .NET installation directory.

Methods

MethodDescription
CheckChecks text for spelling errors and fills the IncorrectWordCollection at TXSpell.IncorrectWords with all incorrect words. The first implementation uses selected dictionaries of the DictionaryCollection at TXSpell.Dictionaries. The second implementation uses selected dictionaries of the TXSpell.Dictionaries DictionaryCollection and the default dictionary folder where the dictionary's language equals to the defined language parameter. Only those dictionaries are used whose Dictionary.IsSpellCheckingEnabled properties are set to true.
CreateInitializes the resources of a newly instantiated TXSpell object. This method must be called before using the object.
CreateSuggestionsDetermines suggestions for a specific incorrect word by using selected dictionaries of the DictionaryCollection at TXSpell.Dictionaries and fills the results into the SuggestionCollection at TXSpell.Suggestions. If no maximum number of suggestions is set, all created suggestions are added into TXSpell.Suggestions. Otherwise, only the first maximum number of suggestions are determined. The second and fourth implementation uses selected dictionaries of the TXSpell.Dictionaries DictionaryCollection and the default dictionary folder where the dictionary's language equals to the defined language parameter. Only those dictionaries are used where the Dictionary.IsGetSuggestionsEnabled property is set to true.
CreateSynonymsReturns groups of synonyms that represent equivalent expressions for a specific text. The first implementation uses selected synonym lists of the SynonymListCollection at TXSpell.SynonymLists. The second implementation uses selected synonym lists of the TXSpell.SynonymLists collection and the default synonym lists folder where the synonym list's language equals to the defined language parameter. The last overload creates synonym groups for a specific synonym list. Only those synonym lists are used whose SynonymList.IsCreateSynonymsEnabled properties are set to true.
DetectLanguageScopesDetects language scopes in a text and fills the results into the LanguageScopeCollection at TXSpell.LanguageScopes.
GetHyphenationPointReturns the next hyphenation point for a specific word right before a defined divide position. Using the first implementation that point is caluclated by applying the default hyphenation list. The second implementation uses a hyphenation list of the TXSpell.HyphenationLists collection or a list from the default hyphenation lists folder that corresponds to the specified language parameter (second implementation). If there is no hyphenation point before that divide position and the position is less the word length, the method returns 0. For divide positions greater than or equal to the number of word characters, the method returns the word length.
GetHyphenationPointsReturns an array of all hyphenation points for a word. Using the first implementation these points are caluclated by applying the default hyphenation list. The second implementation uses a hyphenation list of the TXSpell.HyphenationLists collection or a list from the default hyphenation lists folder that corresponds to the specified language parameter (second implementation).

Further Reading

  • Using TX Spell .NET in ASP.NET –