UserDictionary 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
- Inherits
- Dictionary
- User
Dictionary
Description
The UserDictionary class represents a dictionary that allows to use, create and edit user dictionaries. The first constructor creates an empty UserDictionary object with no reference to a file. The second constructor initializes a new UserDictionary object that is filled with the content of a specified word list file. As with all dictionaries of type Dictionary, the content of the dictionary is only accessed when the dictionary was added to the TXSpell.Dictionaries collection. The third constructor loads a dictionary from string arrays that represent the content of an user dictionary. It is recommended to create that array by using the encoding that was used to create the source of that dictionary. Using that implementation, it is required to define the language of the dictionary through the System.Globalization.CultureInfo language parameter that sets the user dictionary's Language property automatically. To declare a specific encoding for the dictionary, use the Dictionary.DictionaryEncoding property. If the encoding is not declared through the property or inside the word list file, the encoding of operation system's current ANSI code page is used. The UserDictionary class is inherited from the abstract class Dictionary.
Syntax
public sealed class UserDictionary : DictionaryPublic NotInheritable Class UserDictionary
Inherits DictionaryExamples
The following example creates an User Dictionary instance and configures its is editable setting for a document workflow.
TXTextControl.Proofing.UserDictionary userDictionary = new();
userDictionary.IsEditable = true;Dim userDictionary As New TXTextControl.Proofing.UserDictionary()
userDictionary.IsEditable = TrueMembers
Constructors
| Constructor | Description |
|---|---|
| UserDictionary | Initializes a new instance of the UserDictionary class. |
Properties
| Property | Description |
|---|---|
| DictionaryEncoding | Gets or sets the dictionary's encoding. (Inherited from Dictionary.) |
| DisplayName | Gets or sets the text that is displayed for the dictionary inside the options dialog or the SpellCheckDialog's SuggestionDictionaryComboBox. The default value is the name of the dictionary. (Inherited from Dictionary.) |
| FilePath | Gets the name and path of the file that has been used to load this user dictionary or where it has been saved to. If the user dictionary was neither loaded from nor saved as a file, the property returns null. |
| IsEditable | Gets or sets a value indicating whether the user dictionary is editable or not. The default value is true. |
| IsGetSuggestionsEnabled | Gets or sets a value that indicates whether suggestions are created using this dictionary or not. The default value is true. (Inherited from Dictionary.) |
| IsSelectedAsDefault | Gets a value indicating whether the dictionary is selected as the default dictionary by the Language property. The default value is false. (Inherited from Dictionary.) |
| IsSpellCheckingEnabled | Gets or sets a value indicating whether spell checking of this dictionary is enabled or not. The default value is true. (Inherited from Dictionary.) |
| Language | Gets or sets the dictionary's language. (Inherited from Dictionary.) |
| Name | Gets or sets the dictionary's name. (Inherited from Dictionary.) |
| ShowInOptionsDialog | Gets or sets a value indicating whether the dictionary is shown in the options dialog. The default value is true. (Inherited from Dictionary.) |
Methods
| Method | Description |
|---|---|
| AddWord | Adds a word to the user dictionary. The method has no effect, if the UserDictionary.IsEditable property is false or the user dictionary is not added to the TXSpell.Dictionaries or TXSpellChecker.Dictionaries DictionaryCollection. |
| RemoveAllWords | Removes all words from the user dictionary. The method has no effect, if the UserDictionary.IsEditable property is false or the user dictionary is not added to the TXSpell.Dictionaries or TXSpellChecker.Dictionaries DictionaryCollection. |
| RemoveWord | Removes a word the user dictionary. The method has no effect if the UserDictionary.IsEditable property is false or the user dictionary is not added to the TXSpell.Dictionaries or TXSpellChecker.Dictionaries DictionaryCollection. |
| Save | Saves the complete content of the user dictionary in a file at the specified path or as a string array. If using a file name without any file path, the user dictionary is saved in the default dictionary folder. The method has no effect, if the specified path does not end with ".txd" or the user dictionary is not added to the TXSpell.Dictionaries or TXSpellChecker.Dictionaries DictionaryCollection. |
| ToArray | Converts all user dictionary entries to a string array. |