←选择平台

IOcrTableZoneManager接口

总结
代表一个对象用于操纵细胞内表区。
语法
c#
VB
c++
公共接口IOcrTableZoneManager
公共接口IOcrTableZoneManager
公共接口IOcrTableZoneManager
讲话

您可以访问IOcrTableZoneManager通过OCR的页面IOcrPage.TableZoneManager财产。如果此属性的值(没有什么在VB中),那么当前的OCR引擎不支持表格单元操作。

您可以使用表格以两种方式之一:

操纵细胞属性除了它的绑定(OcrZoneCell.Bounds),通过检测细胞的数组IOcrZoneCollection.GetZoneCells,改变单元格的背景颜色,风格或任何边框颜色,风格或。完成后,重新设定使用数组IOcrZoneCollection.SetZoneCells

不建议您手动删除或添加细胞阵列,引擎非常敏感区域边界和任何non-accurate信息将导致一个错误。相反,使用的各种方法IOcrTableZoneManager操纵细胞的位置和大小。

操纵细胞的位置和尺寸表内区是一个非常敏感的物质和任何non-accurate信息将导致一个错误。的IOcrTableZoneManager包含的方法与最小误差轻松地完成这些任务。这些方法是建立在预计将通过一个应用程序,该应用程序通过用户界面操作区域的细胞,如用鼠标点击和拖动。

以下方法可以用来操纵细胞位置和大小:

  • SplitCells和合并细胞分裂/合并表中的特定区域内的细胞区。这使得它很容易添加/删除细胞区。

  • GetPointInformation获得细胞指数和最近的边境对于一个给定的点。这可以通过选择一个细胞或一个边境使用鼠标点击。

  • MoveCellBorderGetCellBorderDragLimit移动单元格边界,同时又能确保它不被车撞到相邻细胞或表。这可以用来改变大小的细胞通过点击和拖动鼠标。

  • GetTabulatorPosition制表机的位置。制表机只有一个水平的位置。

  • GetHorizontalSplittersGetVerticalSplitters得到的数量和位置水平和垂直分割。这些方法你可以画分配器指南在你的用户界面,或者改变鼠标移动到一个不同的形状,如果它坐落在一个分流器和拖是被允许的。

例子
c#
VB
使用Leadtools;使用Leadtools.Codecs;使用Leadtools.Forms.Common;使用Leadtools.Ocr;使用Leadtools.Drawing;私人静态无效IOcrTableZoneManageExample (IOcrEngine ocrEngine,字符串documentFileName){/ /创建一个文档并将页面添加到它使用(IOcrPage ocrPage = ocrEngine.CreatePage (ocrEngine.RasterCodecsInstance。负载(documentFileName, 1), OcrImageSharingMode.AutoDispose)){/ /坐标表之前已经确定:LeadRect tableBounds =LeadRect (266, 554, 404, 647);/ /添加一个表区与这些界限OcrZone区=OcrZone ();区。ZoneType = OcrZoneType.Table;区。边界= tableBounds;ocrPage.Zones.Add(区);如果(ocrPage。TableZoneManager ! =){/ /检测细胞内这张桌子IOcrTableZoneManager ocrTableZoneManager = ocrPage.TableZoneManager;ocrTableZoneManager.AutoDetectCells (0);}/ /显示该区域的细胞(如果有的话)区= ocrPage.Zones [0];Console.WriteLine (“发现价值:“);ShowCells (ocrPage区);/ /改变第一个单元格的样式没有边界OcrZoneCell =[]细胞ocrPage.Zones.GetZoneCells(区);如果(细胞! =& &细胞。长度> 0){OcrZoneCell细胞[0]=细胞;细胞。LeftBorderStyle = OcrCellBorderLineStyle.None;细胞。来pBorderStyle = OcrCellBorderLineStyle.None;细胞。RightBorderStyle = OcrCellBorderLineStyle.None;细胞。BottomBorderStyle = OcrCellBorderLineStyle.None;细胞[0]=细胞;}ocrPage.Zones。SetZoneCells(区、细胞);Console.WriteLine (“更新的值:“);ShowCells (ocrPage区);}}私人静态无效ShowCells (IOcrPage ocrPage OcrZone区){OcrZoneCell =[]细胞ocrPage.Zones.GetZoneCells(区);如果(细胞! =){Console.WriteLine (“表包含{0}区”,cells.Length);(int我= 0;我< cells.Length;我+ +){Console.WriteLine (“细胞{0}:“,我);OcrZoneCell细胞=细胞[我];Console.WriteLine (“类型:{0}”,cell.CellType);Console.WriteLine (“范围:{0}”,cell.Bounds);Console.WriteLine (“背景色:{0}”,cell.BackgroundColor);Console.WriteLine (“左边框颜色:{0}”,cell.LeftBorderColor);Console.WriteLine (“左边框宽度:{0}”,cell.LeftBorderWidth);Console.WriteLine (“左边框样式:{0}”,cell.LeftBorderStyle);Console.WriteLine (“顶级边框颜色:{0}”,cell.TopBorderColor);Console.WriteLine (“顶级边框宽度:{0}”,cell.TopBorderWidth);Console.WriteLine (“顶级边框样式:{0}”,cell.TopBorderStyle);Console.WriteLine (“右边框颜色:{0}”,cell.RightBorderColor);Console.WriteLine (“右边框宽度:{0}”,cell.RightBorderWidth);Console.WriteLine (“右边框样式:{0}”,cell.RightBorderStyle);Console.WriteLine (“底部边框颜色:{0}”,cell.BottomBorderColor);Console.WriteLine (“底部边框宽度:{0}”,cell.BottomBorderWidth);Console.WriteLine (“底部边框样式:{0}”,cell.BottomBorderStyle);}}}
进口Leadtools进口Leadtools.Codecs进口Leadtools.Forms进口Leadtools.Ocr进口Leadtools.Drawing公共IOcrTableZoneManageExample (ocrEngine作为IOcrEngine, documentFileName作为字符串)创建一个文档并将页面添加到它使用ocrPage作为IOcrPage = ocrEngine.CreatePage (ocrEngine.RasterCodecsInstance。负载(documentFileName, 1)、OcrImageSharingMode.AutoDispose)的坐标表之前已经确定:昏暗的tableBounds作为LeadRect (266、554、404、647)“添加一个表区与这些界限昏暗的作为OcrZone ()区。ZoneType = OcrZoneType.Table区。边界= tableBoundsocrPage.Zones.Add(区)检测细胞内这张桌子昏暗的ocrTableZoneManager作为IOcrTableZoneManager = ocrPage.TableZoneManagerocrTableZoneManager.AutoDetectCells (0)该区域的显示细胞(如果有的话)区= ocrPage.Zones (0)Console.WriteLine (“发现价值:“)ShowCells (ocrPage区)“改变第一个单元格的样式没有边界昏暗的细胞作为OcrZoneCell () = ocrPage.Zones.GetZoneCells(区)如果细胞不是没有什么需要说明细胞。长度> 0然后昏暗的细胞作为OcrZoneCell =细胞(0)细胞。LeftBorderStyle = OcrCellBorderLineStyle.None细胞。来pBorderStyle = OcrCellBorderLineStyle.None细胞。RightBorderStyle = OcrCellBorderLineStyle.None细胞。BottomBorderStyle = OcrCellBorderLineStyle.None细胞细胞(0)=结束如果ocrPage.Zones。SetZoneCells(带电池)Console.WriteLine (“更新的值:“)ShowCells (ocrPage区)结束使用结束私人共享ShowCells (ocrPage作为IOcrPage,区作为OcrZone)昏暗的细胞作为OcrZoneCell () = ocrPage.Zones.GetZoneCells(区)如果细胞不是没有什么然后Console.WriteLine (“表包含{0}区”cells.Length)作为整数= 0细胞。长度- 1Console.WriteLine (“细胞{0}:“,我)昏暗的细胞作为OcrZoneCell =细胞(我)Console.WriteLine (“类型:{0}”cell.CellType)Console.WriteLine (“范围:{0}”cell.Bounds)Console.WriteLine (“背景色:{0}”cell.BackgroundColor)Console.WriteLine (“左边框颜色:{0}”cell.LeftBorderColor)Console.WriteLine (“左边框宽度:{0}”cell.LeftBorderWidth)Console.WriteLine (“左边框样式:{0}”cell.LeftBorderStyle)Console.WriteLine (“顶级边框颜色:{0}”cell.TopBorderColor)Console.WriteLine (“顶级边框宽度:{0}”cell.TopBorderWidth)Console.WriteLine (“顶级边框样式:{0}”cell.TopBorderStyle)Console.WriteLine (“右边框颜色:{0}”cell.RightBorderColor)Console.WriteLine (“右边框宽度:{0}”cell.RightBorderWidth)Console.WriteLine (“右边框样式:{0}”cell.RightBorderStyle)Console.WriteLine (“底部边框颜色:{0}”cell.BottomBorderColor)Console.WriteLine (“底部边框宽度:{0}”cell.BottomBorderWidth)Console.WriteLine (“底部边框样式:{0}”cell.BottomBorderStyle)下一个结束如果结束
需求

目标平台

Leadtools.Ocr作为sembly
188金宝搏的网址客服|支持|联系我们|知识产权的通知
©1991 - 2021领先的技术公司。保留所有权利。