←Select platform

GetSupportedCellTypes Method

Summary
Gets the cell types supported by this OCR engine.
Syntax
C#
C++/CLI
Python
public OcrZoneType[] GetSupportedCellTypes() 
array<OcrZoneType>^ GetSupportedCellTypes();  
def GetSupportedCellTypes(self): 

Return Value

An array of OcrZoneType enumeration members that specify the cell types supported by this OCR engine.

Remarks

These are the only cell types that may be returned from the engine when table cells are auto-detected or you can manually set into OcrZoneCell.CellType. Setting any other cell type will result in an exception being thrown.

In the future, this restriction might be removed when more cell types are supported, it is recommended that you use GetSupportedCellTypes to programmatically get a list of the supported types and construct and user interface from the values returned from this method (for example, a combo box for cell type selection in your application).

You can use table cells in one of two ways:

  • Perform auto-zoning on the page using IOcrPage.AutoZone, if the page contains a detected table, the a zone of type OcrZoneType.Table is created for this table. If the engine successfully detects the cells of the table, then it will fill the an internal OcrZoneCell array with the properties of the detected cells.

  • Manually add a new OcrZone with its type set to OcrZoneType.Table to the zones collection of a page. Leave the value of the cells to null (Nothing in VB), now use the IOcrTableZoneManager.AutoDetectCells method to instruct the engine to detect any cells in this zone and fill the array with the data.

To manipulate a cell properties other than its bound (OcrZoneCell.Bounds), get the array of detected cells through IOcrZoneCollection.GetZoneCells, change the cell background color, style or any border color, style or with. When you are done, re-set the array using IOcrZoneCollection.SetZoneCells.

It is not recommended that you manually remove or add cells to the array, the engine is very sensitive to zone boundaries and any non-accurate information will cause an error. Instead, use the various methods of IOcrTableZoneManager to manipulate the cell location and size.

Example
C#
using Leadtools; 
using Leadtools.Codecs; 
using Leadtools.Forms.Common; 
using Leadtools.Ocr; 
using Leadtools.Drawing; 
 
private static void GetSupportedCellTypesExample(IOcrPage ocrPage) 
{ 
   Console.WriteLine("The engine of type {0} supports these zone cell types:", ocrPage.Document.Engine.EngineType); 
   IOcrTableZoneManager ocrTableZoneManager = ocrPage.TableZoneManager; 
   if (ocrTableZoneManager != null) 
   { 
      OcrZoneType[] cellTypes = ocrTableZoneManager.GetSupportedCellTypes(); 
      foreach (OcrZoneType cellType in cellTypes) 
      { 
         Console.WriteLine(cellType.ToString()); 
      } 
   } 
   else 
   { 
      Console.WriteLine("Cells not supported."); 
   } 
} 
Requirements

Target Platforms

Help Version 23.0.2024.4.19
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Ocr Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.