Leadtools.Document Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
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.
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
)
Managed Extensions for 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 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Documentrequires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features