TextValidator Object (ITextValidator Interface)
The TextValidator object is an ActiveX control that allows you to verify uncertainly recognized characters in a document. The document is connected to the component via the FRDocument property.
The Text Validator component may look like this:
For texts with vertical writing direction:
See the illustration
To start spell checking, you should call either Spell or SpellBlock method of the TextValidator object. If the spell check is already in progress, you need first to stop it, or the new calls to these methods will be ignored.
Notes:
- You can also start spell checking using the Check Spelling button in Text Editor.
- Some characters of complex script languages (e.g., Chinese, Thai, Armenian) can be not displayed in Text Validator, if the font used in Text Validator does not include corresponding characters. In this case, you can specify another font in the Options dialog box (in Text Validator click Settings > Options, go to the View tab and select the font in the Font used to display plain text drop-down list).
The information on spell checking is reported through special outgoing interfaces. These interfaces are ITextValidatorEvents (for C++) and a dispinterface DITextValidatorEvents (for Visual Basic).
It's worth noting that Visual Basic users should not care for details of event interfaces implementation as this development platform provides easy means for handling them. This object may be declared WithEvents in Visual Basic.
For C++ user this fact means that it supports the IConnectionPointContainer interface. To receive notification events, a C++ user should create an object derived from the ITextValidatorEvents interface, then set up the connection between it and events source implemented in TextValidator object by standard COM means.
The Text Validator component can be connected to the Component Synchronizer component, in which case all the events in Text Validator will be automatically transmitted to other components connected to the Synchronizer and the whole application will work synchronously.
Properties
Name | Type | Description |
---|---|---|
AddedWords | SpellWordCollection, read-only |
Represents a collection of words which were added to a dictionary by a user during spell checking. Note: If words are added to a dictionary during spell checking, the user dictionary is created in the folder specified by the ILanguageDatabase::DictionaryExtensionsPath property. |
AutoReplacedWords | SpellReplacementCollection | Represents a collection of words pairs. The first word in the pair is the source word which is automatically replaced during spell checking, the second one is the replacement. |
CorrectSpaces | VARIANT_BOOL |
Specifies if Text Validator should correct spaces during spell checking. If you set the value of this property to TRUE, Text Validator will correct spaces before or after punctuation marks. By default, the value is FALSE. |
IgnoredWords | SpellWordCollection | Represents a collection of words which should be ignored during spell checking. |
IsSpellingInProgress | VARIANT_BOOL, read-only | Specifies whether the spell checking is in progress. |
FRDocument | FRDocument | Represents the document connected to Text Validator. |
Locked | VARIANT_BOOL |
Specifies whether Text Validator is locked. This property is useful in the following situations:
In this case, we recommend that you set this property to TRUE before analysis, recognition, synthesis or export, and set it to FALSE after the end of the operation. In this case, the document cannot be spoilt from Text Validator. By default, the value is FALSE. |
ReplacedWords | SpellReplacementCollection | Represents a collection of words pairs. The first word in the pair is the source word which is replaced during spell checking, the second one is the replacement. |
SettingsPath | BSTR |
Specifies the path to the folder which contains files with the settings of Text Validator. Other Visual Components have the same property. Each Visual Component should use its own folder with settings. The value of this property is constructed from the path to the folder, in which ABBYY FineReader Engine stores user-specific data, and the name of its subfolder. By default, the folder with user-specific data is the FineReader Engine data folder. It can be changed during initialization of FineReader Engine (via the InitializeEngine function, or via the IEngineLoader::InitializeEngine method). The default name of the subfolder is an arbitrary GUID. To change the name of the subfolder, you should specify the new name in the properties of the component in Visual Studio at design time. If you try to specify the value of the property at run time, this value is ignored. If you add the component to a form in Visual Studio when designing, the value of the property is defined either automatically with the default value, or manually with a custom value. In both cases the value is defined at design time. If for some reason the value of the property is not defined at design time (e.g., if you generate the component dynamically at run time), the component creates a new folder with the settings each time the component is initialized. To avoid multiplication of the folders, you should delete the created settings folder after the component deinitialization. In this case, you can use only the default settings of the component and cannot save the settings between sessions. |
StopAtCompound | VARIANT_BOOL |
Specifies if Text Validator should stop at compound words during spell checking. By default, the value is FALSE. |
StopAtGarbage | VARIANT_BOOL |
Specifies if Text Validator should stop at garbage during spell checking. Garbage is characters combination with no sense. By default, the value is FALSE. |
StopAtNonDictionary | VARIANT_BOOL |
Specifies if Text Validator should stop at the words which are not found in the dictionary during spell checking. This property and StopAtUncertain property cannot be set to FALSE simultaneously. By default, the value is TRUE. |
StopAtUncertain | VARIANT_BOOL |
Specifies if Text Validator should stop at uncertainly recognized characters during spell checking. This property and StopAtNonDictionary property cannot be set to FALSE simultaneously. By default, the value is TRUE. |
SuggestedWords | SpellWordCollection, read-only | Represents a collection of words which were suggested to correct spelling of uncertainly recognized words during spell checking. |
SynthesisParamsForDocument | SynthesisParamsForDocument |
Specifies the default synthesis parameters for a document. These parameters are used if Text Validator needs to perform document synthesis (this may happen if the logical structure of a document becomes incorrect due to some editing operations). Note: If Text Validator is connected to Component Synchronizer, use the IComponentSynchronizer::ProcessingParams property to change parameters used for document synthesis. If you change these parameters via the property of Text Validator, errors may occur. |
ValidatorError | ValidatorError, read-only | Represents a position of an uncertain character or uncertain word. |
WindowHandle | __int64, read-only | Returns the window handle of the client area. |
Methods
Name | Description |
---|---|
EndSpelling | Stops spell checking. |
Spell | Starts spell checking from the specified position. |
SpellBlock | Checks spelling in the specified block. |
UpdateOptions | Updates the settings specified in the Options dialog box of Text Validator. You may need to call this method, if the options have been changed in some other Visual Component, to update the options to the current state. |
Samples
This component is used in the following code samples: VisualComponents.
See also
17.09.2024 15:14:40