Leadtools.Document Deprecated as of v16. Refer to: Leadtools.Forms.Ocr | Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
SetUserDictionary Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class : SetUserDictionary Method



userDictionaryName
The user's dictionary file name.
userDefaultSectionName
The name of the default section in the user's dictionary.
createUserDictionary
Flag to determine method behavior. Possible values are:
  • true: Create a new user dictionary in memory
  • false: Save the current user dictionary to the file indicated in the DictionaryFileName property and DictionaryDefaultSection property.
userDictionaryName
The user's dictionary file name.
userDefaultSectionName
The name of the default section in the user's dictionary.
createUserDictionary
Flag to determine method behavior. Possible values are:
  • true: Create a new user dictionary in memory
  • false: Save the current user dictionary to the file indicated in the DictionaryFileName property and DictionaryDefaultSection property.
Sets the User dictionary and its default section to be used by the checking subsystem.

Syntax

Visual Basic (Declaration) 
Public Sub SetUserDictionary( _
   ByVal userDictionaryName As String, _
   ByVal userDefaultSectionName As String, _
   ByVal createUserDictionary As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As RasterDocumentEngine
Dim userDictionaryName As String
Dim userDefaultSectionName As String
Dim createUserDictionary As Boolean
 
instance.SetUserDictionary(userDictionaryName, userDefaultSectionName, createUserDictionary)
C# 
public void SetUserDictionary( 
   string userDictionaryName,
   string userDefaultSectionName,
   bool createUserDictionary
)
C++/CLI 
public:
void SetUserDictionary( 
   String^ userDictionaryName,
   String^ userDefaultSectionName,
   bool createUserDictionary
) 

Parameters

userDictionaryName
The user's dictionary file name.
userDefaultSectionName
The name of the default section in the user's dictionary.
createUserDictionary
Flag to determine method behavior. Possible values are:
  • true: Create a new user dictionary in memory
  • false: Save the current user dictionary to the file indicated in the DictionaryFileName property and DictionaryDefaultSection property.

Example

Visual BasicCopy Code
Public Sub SetUserDictionaryExample()
   ' Note that this is a sample key, which will not work in your toolkit
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey")

   Dim rasterDocument As RasterDocumentEngine
   rasterDocument = RasterDocumentEngine.Instance
   rasterDocument.Startup()

   rasterDocument.SetUserDictionary("USERDIC1.DIC", "cities", True)

   Dim item As RasterDocumentUserDictionaryItem = RasterDocumentUserDictionaryItem.Empty
   item.Value = "Peabody"
   item.Attribute = RasterDocumentDictionaryAttribute.Literal

   rasterDocument.AddItemToUserDictionary("cities", item)

   item.Value = "Budapest"
   item.Attribute = RasterDocumentDictionaryAttribute.Literal
   rasterDocument.AddItemToUserDictionary("cities", item)
   rasterDocument.SetUserDictionary("USERDIC1.DIC", "cities", False)
   rasterDocument.Shutdown()
End Sub
C#Copy Code
public void SetUserDictionaryExample() 

   // Note that this is a sample key, which will not work in your toolkit 
   RasterSupport.Unlock(Leadtools.RasterSupportType.Ocr, "TestKey"); 
 
   RasterDocumentEngine rasterDocument; 
   rasterDocument = RasterDocumentEngine.Instance; 
   rasterDocument.Startup(); 
 
   rasterDocument.SetUserDictionary("USERDIC1.DIC", "cities", true); 
 
   RasterDocumentUserDictionaryItem item = RasterDocumentUserDictionaryItem.Empty; 
   item.Value = "Peabody"; 
   item.Attribute = RasterDocumentDictionaryAttribute.Literal; 
 
   rasterDocument.AddItemToUserDictionary("cities", item); 
 
   item.Value = "Budapest"; 
   item.Attribute = RasterDocumentDictionaryAttribute.Literal; 
   rasterDocument.AddItemToUserDictionary("cities", item); 
   rasterDocument.SetUserDictionary("USERDIC1.DIC", "cities", false); 
   rasterDocument.Shutdown(); 
}

Remarks

Specifies a User dictionary and its default section to be used by the checking subsystem. This method can also be used to initiate the creation of a new, empty User dictionary in memory. To disable a previously enabled User dictionary, pass true for createUD when calling SetUserDictionary. When creating a new, empty User dictionary, pass true for createUserDictionary. If you save a user dictionary by calling this method with createUserDictionary set to false, the user dictionary is saved to the file specified in the userDictionaryName and property and userDefaultSectionName parameters. If you later want to set the user dictionary to use this file, call SetUserDictionary with the name of the file that contains the user dictionary set in the userDictionaryName and property and userDefaultSectionName parameters and pass false for the createUserDictionary parameter.
For more information, refer to Working with a Dictionary.
For more information, refer to Working with a Dictionary.

Requirements

Target Platforms: Microsoft .NET Framework 3.0, Windows XP, Windows Server 2003 family, Windows Server 2008 family

See Also

The Leadtools.Document namespace is deprecated and no longer supported as of LEADTOOLS v16. For v16 and later, please refer to: Leadtools.Forms.Ocr. This documentation is retained for v15 and earlier informational use only.