TXSpell Class
- Namespace
TXTextControl.Proofing
- Package
TXTextControl.from the private NuGet feed or Text Control Offline PackagesTXSpell. WinForms. SDK
- Assembly
TXSpell.dll
- Install
dotnet add package TXTextControl..NET 8 and later. For .NET Framework, referenceTXSpell. WinForms. SDK TXSpell.from the setup.dll
- Also in
TXTextControl.asTXSpell. Core. SDK 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 TXSpellPublic NotInheritable Class TXSpellExamples
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";Dim tXSpell As New TXTextControl.Proofing.TXSpell()
tXSpell.DictionariesDirectoryPath = "document.docx"Members
Constructors
| Constructor | Description |
|---|---|
| TXSpell | Initializes a new instance of the TXSpell class. |
Properties
| Property | Description |
|---|---|
| AvailableDictionaries | Gets a list of all available dictionaries of the default dictionary folder. |
| AvailableHyphenationLists | Gets a list of all available hyphenation lists of the default hyphenation lists folder. |
| AvailableSynonymLists | Gets a list of all available synonym lists of the default synonym lists folder. |
| DetectableLanguageScopes | Gets or sets a list of all languages that are used to detect language scopes in a text. |
| Dictionaries | Gets a collection of all added and validated dictionaries. The property's value is an object of type DictionaryCollection. |
| DictionariesDirectoryPath | Gets 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. |
| HyphenationLanguage | Gets 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)". |
| HyphenationLists | Gets a collection of all added hyphenation dictionaries. The property's value is an object of type HyphenationListCollection. |
| HyphenationListsDirectoryPath | Gets 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. |
| IgnoreCase | Gets 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. |
| IgnoreWord | Gets or sets a value of type IgnoreWordSettings determining when a word should not be spell checked. The default value is InUpperCase | IsEmail | IsURL | WithNumbers. |
| IncorrectWords | Gets 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. |
| Language | Gets 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)". |
| LanguageRecognitionDirectoryPath | Gets 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. |
| LanguageScopes | Gets a collection of all detected language scopes. The property's value is an object of type LanguageScopeCollection. |
| SpellingCorrectionUIProvider | Gets an object of type SpellingCorrectionUIProvider to provide methods and properties for constructing a spelling correction user interface. |
| Suggestions | Gets 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. |
| SynonymLanguage | Gets 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)". |
| SynonymLists | Gets a collection of all added synonym lists. The property's value is an object of type SynonymListCollection. |
| SynonymListsDirectoryPath | Gets 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
| Method | Description |
|---|---|
| Check | Checks 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. |
| Create | Initializes the resources of a newly instantiated TXSpell object. This method must be called before using the object. |
| CreateSuggestions | Determines 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. |
| CreateSynonyms | Returns 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. |
| DetectLanguageScopes | Detects language scopes in a text and fills the results into the LanguageScopeCollection at TXSpell.LanguageScopes. |
| GetHyphenationPoint | Returns 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. |
| GetHyphenationPoints | Returns 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). |