Table block
A Table block is used for carries over to FlexiCapture the coordinates of the detected tables. The data from the detected tables will be extract in the FlexiCapture. A Table block is different from other types of block in that it returns not only a region enclosing the entire block, but also rectangles drawn around each table cell. Compared to other types of block, a Table block has an additional property - a list of columns that the table may contain. A FlexiLayout may contain one or more Table elements telling the program where and how to look for the columns specified in the block.
Note.
- Upon creating a Table element you need to 'bind' it to the already created Table block. So you usually need to start with creating a block. You can first specify its approximate search area, then create one or more elements to look for the block, and then use these Table elements to finalize the search area of the block.
- You can create several elements each of which describes its own algorithm of finding one and the same Table block. You can instruct the program to select the Table element which best fits the table block after the block has been found. This is done by means of a Region expression.
Table blocks are marked with in the FlexiLayout tree.
To create a Table block:
- Switch to the FlexiLayout window.
- Select the Blocks branch in the FlexiLayout tree.
- From the FlexiLayout menu, select Add Block → Table or select New → Table from the shortcut menu.
- Specify the properties of the block.
- On the Table block tab set the following:
- the name of the block;
- your commentary to the block (optional);
- if the region of the block and division of the table into rows and columns will coincide with the region returned by a Table element, select the Source element option and click . In the Select Element dialog box, select the Table element whose region coincides with the region of the block and click OK.
- if the region of the block does not coincide with the region of any of the Table elements, select the Region expression option and enter the required code in the Region expression field. Click Check to check the code.
- On the Columns tab, specify the columns that may occur within the block. To do this, click Add... and enter the name of a column. You may find it convenient to use the names of columns as they occur on the test images. From the Type drop-down list, select the desired type of the column. You can change one of the following types: Text, Barcode, Checkmark, Picture or Non-Recognized Block. To change the name or type of a column, click Edit... and in the Edit Table Column dialog box, enter a new name or select a different type for the column. Use the (Down) and (Up) buttons to arrange the columns in the same order in which they must occur in data capture application
An example of specifying which block region to select
To specify the region of a block, use the pre-defined variable OutputTable of type TableHypothesis.
The code in the example below selects the Table element in which the most rows have been found
let T1 = SearchElements.TableElement1;
let T2= SearchElements.TableElement2;
if T1.RowsCount > T2.RowsCount then OutputTable = T1; else OutputTable = T2;
Note.The table elements SearchElements.TableElement1 and SearchElements.TableElement2 in the example must refer to the same Table block whose Region expression field contains the above code.
12.04.2024 18:16:02