公共接口IOcrTableZoneManager
公共接口IOcrTableZoneManager
公共接口类IOcrTableZoneManager
您可以访问IOcrTableZoneManager通过OCR的页面IOcrPage.TableZoneManager财产。如果此属性的值零(没有什么在VB中),那么当前的OCR引擎不支持表格单元操作。
您可以使用表格以两种方式之一:
执行auto-zoning在页面上使用IOcrPage.AutoZone如果发现页面包含一个表,一个区域的类型OcrZoneType.Table创建这个表。如果发动机成功地检测到细胞的表,那么它将填补一个内部OcrZoneCell检测细胞的属性数组。
手动添加一个新的OcrZone类型设置OcrZoneType.Table区域的页面集合。离开细胞的价值零(没有什么在VB),现在使用IOcrTableZoneManager.AutoDetectCells方法指示发动机发现任何细胞在该区域,并使用数据填充该数组。
操纵细胞属性除了它的绑定(OcrZoneCell.Bounds),通过检测细胞的数组IOcrZoneCollection.GetZoneCells,改变单元格的背景颜色,风格或任何边框颜色,风格或。完成后,重新设定使用数组IOcrZoneCollection.SetZoneCells。
不建议您手动删除或添加细胞阵列,引擎非常敏感区域边界和任何non-accurate信息将导致一个错误。相反,使用的各种方法IOcrTableZoneManager操纵细胞的位置和大小。
操纵细胞的位置和尺寸表内区是一个非常敏感的物质和任何non-accurate信息将导致一个错误。的IOcrTableZoneManager包含的方法与最小误差轻松地完成这些任务。这些方法是建立在预计将通过一个应用程序,该应用程序通过用户界面操作区域的细胞,如用鼠标点击和拖动。
以下方法可以用来操纵细胞位置和大小:
SplitCells和合并细胞分裂/合并表中的特定区域内的细胞区。这使得它很容易添加/删除细胞区。
GetPointInformation获得细胞指数和最近的边境对于一个给定的点。这可以通过选择一个细胞或一个边境使用鼠标点击。
MoveCellBorder和GetCellBorderDragLimit移动单元格边界,同时又能确保它不被车撞到相邻细胞或表。这可以用来改变大小的细胞通过点击和拖动鼠标。
GetTabulatorPosition制表机的位置。制表机只有一个水平的位置。
GetHorizontalSplitters和GetVerticalSplitters得到的数量和位置水平和垂直分割。这些方法你可以画分配器指南在你的用户界面,或者改变鼠标移动到一个不同的形状,如果它坐落在一个分流器和拖是被允许的。
使用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
区。边界= tableBounds
ocrPage.Zones.Add(区)
检测细胞内这张桌子
昏暗的ocrTableZoneManager作为IOcrTableZoneManager = 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 (ocrPage作为IOcrPage,区作为OcrZone)
昏暗的细胞作为OcrZoneCell () = ocrPage.Zones.GetZoneCells(区)
如果细胞不是没有什么然后
Console.WriteLine (“表包含{0}区”cells.Length)
为我作为整数= 0来细胞。长度- 1
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)
下一个
结束如果
结束子
帮助收藏
光栅net|C API|c++类库|HTML5 JavaScript
文档net|C API|c++类库|HTML5 JavaScript
医疗net|C API|c++类库|HTML5 JavaScript
医疗Web查看器net
188宝金博怎么下载
支持的平台上
net, Java, Android和iOS / macOS组件
C / c++类库的API
HTML5 JavaScript库
你的邮件已经发送到支持!有人应该联系!如果你的问题是紧急请回到聊天。
聊天时间:
周一——周五,上午6点等
谢谢你的反馈!
请填写表单重新开始一个新的聊天。
所有代理目前离线。
聊天时间:
周一-周五
早上8:30 - 6点
联系我们请填写这张表格,我们将通过电子邮件联系你。