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
GetUserDictionarySection Method
See Also  Example
Leadtools.Document Namespace > RasterDocumentEngine Class : GetUserDictionarySection Method



firstSection
Specifies whether to get the first section.
firstSection
Specifies whether to get the first section.
Gets a list of user dictionary sections.

Syntax

Visual Basic (Declaration) 
Public Function GetUserDictionarySection( _
   ByVal firstSection As Boolean _
) As String
Visual Basic (Usage)Copy Code
Dim instance As RasterDocumentEngine
Dim firstSection As Boolean
Dim value As String
 
value = instance.GetUserDictionarySection(firstSection)
C# 
public string GetUserDictionarySection( 
   bool firstSection
)
C++/CLI 
public:
String^ GetUserDictionarySection( 
   bool firstSection
) 

Parameters

firstSection
Specifies whether to get the first section.

Return Value

A string that contains the section name.

Example

Visual BasicCopy Code
Public Sub GetUserDictionarySectionExample()
   ' 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()

   Try
      Dim buffer As String = String.Format("User Dictionray Name = {0}" & Constants.vbLf & "Default Section Name = {1}", rasterDocument.DictionaryFileName, rasterDocument.DictionaryDefaultSection)
      MessageBox.Show(buffer)

      Dim state As Boolean = rasterDocument.DictionaryState
      If state Then
         MessageBox.Show("The current user dictionary is changed")
      Else
         MessageBox.Show("The current user dictionary is not changed")
      End If

      Dim section As String = rasterDocument.GetUserDictionarySection(True)
      buffer = String.Format("First Section in the current User Dictionray = {0}", section)
      MessageBox.Show(buffer)

      Dim item As RasterDocumentUserDictionaryItem = rasterDocument.GetUserDictionarySectionItem(section, True)
      buffer = String.Format("1st Section Item in the 1st section of the current User Dictionray = {0}", item.Value)
      MessageBox.Show(buffer)
   Catch ex As Exception
      MessageBox.Show(ex.Message)
   End Try

   rasterDocument.Shutdown()
End Sub
C#Copy Code
public void GetUserDictionarySectionExample() 

   //  Note that this is a sample key, which will not work in your toolkit 
   RasterSupport.Unlock(RasterSupportType.Ocr, "TestKey"); 
   RasterDocumentEngine rasterDocument; 
   rasterDocument = RasterDocumentEngine.Instance; 
   rasterDocument.Startup(); 
 
   try 
   { 
      string buffer = String.Format("User Dictionray Name = {0}\nDefault Section Name = {1}", rasterDocument.DictionaryFileName, rasterDocument.DictionaryDefaultSection); 
      MessageBox.Show(buffer); 
 
      bool state = rasterDocument.DictionaryState; 
      if (state) 
         MessageBox.Show("The current user dictionary is changed"); 
      else 
         MessageBox.Show("The current user dictionary is not changed"); 
 
      string section = rasterDocument.GetUserDictionarySection(true); 
      buffer = String.Format("First Section in the current User Dictionray = {0}", section); 
      MessageBox.Show(buffer); 
 
      RasterDocumentUserDictionaryItem item = rasterDocument.GetUserDictionarySectionItem(section, true); 
      buffer = String.Format("1st Section Item in the 1st section of the current User Dictionray = {0}", item.Value); 
      MessageBox.Show(buffer); 
   } 
   catch (Exception ex) 
   { 
      MessageBox.Show(ex.Message); 
   } 
 
   rasterDocument.Shutdown(); 
}

Remarks

Gets a list of user dictionary sections.
Call this method multiple times to get each section in a user dictionary. The first time you call it, pass true for firstSection. In each subsequent call, pass false for firstSection, and Leadtools will get the next section from the specified dictionary. To re-start the process, call this method again, and pass true for firstSection.

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.