> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Table block

> Table blocks pass detected table coordinates and cell rectangles to ABBYY FlexiCapture: create the block, list columns, and pick a region with OutputTable.

A **Table** block is used to pass the coordinates of the detected tables to FlexiCapture. The data from the detected tables will be extracted in 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.

* When you create a **Table** element, you need to 'bind' it to an already created **Table** block, so you usually need to create the block first. You can first specify its approximate search area, and 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 for 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 <img src="https://mintcdn.com/abbyy/lqYknuOmCa79141v/images/flexi-capture/fls/Table_Block.gif?fit=max&auto=format&n=lqYknuOmCa79141v&q=85&s=b587cb447531d0883066fce4033ae88e" alt="Table block icon" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="15" height="15" data-path="images/flexi-capture/fls/Table_Block.gif" /> in the FlexiLayout tree.

## Create a Table block

<Steps>
  <Step title="Switch to the FlexiLayout window" />

  <Step title="Select the Blocks branch">
    Select the **Blocks** branch in the **FlexiLayout** tree.
  </Step>

  <Step title="Add a Table block">
    From the **FlexiLayout** menu, select **Add Block → Table**; or select **New → Table** from the shortcut menu.
  </Step>

  <Step title="Set the block properties on the Table block tab">
    Specify:

    * The name of the block.
    * An optional comment.
    * If the block region and the division of the table into rows and columns coincide with the region returned by a **Table** element, select the **Source element** option and click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Search.gif?s=36d8764847225cffab245081f5274192" alt="Search button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="31" height="18" data-path="images/flexi-capture/fls/Button_Search.gif" />. In the **Select Element** dialog box, select the **Table** element whose region coincides with the region of the block, and then click **OK**.
    * If the block region does not coincide with the region of any **Table** element, select the **Region expression** option and enter the required code in the **Region expression** field. Click **Check** to check the code.
  </Step>

  <Step title="Specify the columns on the Columns tab">
    Specify the columns that may occur within the block:

    1. Click **Add...** and enter the name of a column. It is convenient to use the column names as they occur on the test images.
    2. From the **Type** drop-down list, select the type of the column: **Text**, **Barcode**, **Checkmark**, **Picture**, or **Non-Recognized Block**.
    3. To change a column's name or type, click **Edit...** and, in the **Edit Table Column** dialog box, enter a new name or select a different type.
    4. Use the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Down_Table.gif?fit=max&auto=format&n=fmgRWFNHKYN2MLSg&q=85&s=0b97cc8954437f7ce4a776808f92f271" alt="Down button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="27" height="18" data-path="images/flexi-capture/fls/Button_Down_Table.gif" /> and <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Button_Up_Table.gif?s=1223f3bf294a1e1de73888cbc5479e4d" alt="Up button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="27" height="18" data-path="images/flexi-capture/fls/Button_Up_Table.gif" /> buttons to arrange the columns in the order in which they must occur in the data capture application.
  </Step>
</Steps>

## Example: specify 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 following example selects the **Table** element in which the most rows have been found:

```text theme={null}
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.
</Note>
