> ## 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.

# Sample 4. Step 8: Table element, InvoiceTable element

> Combine the prepared elements into an InvoiceTable Table element that finds the multi-page invoice table, with master columns and column content types.

Now that all the preparations are made, search for the **Invoice Table** field by creating a [Table](/flexi-capture/fls/tables/general-tables) element. The table has three parts to describe:

* **Header** of the table – Specify the column names using the already detected auxiliary elements.
* **Footer** of the table – Use the already detected required **Paragraph** element from the **InvoiceFooter** group, which identifies the beginning of the final part. This element was described as the closest to the bottom of the table.
* **Search area** for the table – Limit the search area on the right with the name of the last column, **Sales**, which is not needed for any other purpose.

## Create the InvoiceTable element

<Steps>
  <Step title="Create the Table element">
    In the **SearchElements** tree, create a [Table](/flexi-capture/fls/tables/general-tables) element and name it **InvoiceTable**.
  </Step>

  <Step title="Select the table block">
    Click the **Columns** tab, and then click **Select** to select the **InvoiceTable** block created earlier in [Step 3](/flexi-capture/fls/tutorial4/4step3) as the block to search for.
  </Step>

  <Step title="Assign the column names">
    Specify the search parameters for the table columns. For each column, select it in the list, click **Properties...**, select **Use found element as column name**, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and select the previously detected element:

    | Column          | Column name element         |
    | :-------------- | :-------------------------- |
    | **Reference**   | `TableHeader.kwReference`   |
    | **Designation** | `TableHeader.kwDesignation` |
    | **Unit**        | `TableHeader.kwUnit`        |
    | **Quantity**    | `TableHeader.kwQuantity`    |
    | **UnitPrice**   | `TableHeader.kwUnitPrice`   |
    | **Total**       | `TableHeader.kwTotal`       |
  </Step>

  <Step title="Set the column order">
    Click the **Order** tab. Because the columns being searched for may be separated by other columns (for example, **ExtraQtyTag**) but their order is always fixed (first **Designation**, then **Unit Price**, then **Total**), select **Rules for column order**, click **Add...**, and add the columns in this order: `Designation << Unit Price << Total`.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial4_8_1_.PNG?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=966aae17c9b42b5787008df2964196c7" alt="Screenshot of the Order tab of the InvoiceTable Table element properties in ABBYY FlexiLayout Studio, showing Rules for column order selected with the Designation, Unit Price, and Total columns added in the required order." width="431" height="455" data-path="images/flexi-capture/fls/tutorial4_8_1_.PNG" />
    </Frame>
  </Step>

  <Step title="Keep the header defaults">
    Click the **Header** tab. The table header is needed, but no additional constraints are imposed, so keep the default values.
  </Step>

  <Step title="Set the table footer">
    Click the **Footer** tab. Use the previously detected `InvoiceFooter.Paragraph` element for the final part of the table. Select the **Use found element as footer** option, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and select the `InvoiceFooter.Paragraph` element.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial4_8_2_.PNG?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=e7a855370a3d7b6766311f63e86cd3b8" alt="Screenshot of the Footer tab of the InvoiceTable Table element properties in ABBYY FlexiLayout Studio, showing the Use found element as footer option selected with the InvoiceFooter.Paragraph element chosen as the table footer." width="431" height="455" data-path="images/flexi-capture/fls/tutorial4_8_2_.PNG" />
    </Frame>
  </Step>

  <Step title="Set the master columns for rows">
    Click the **Rows** tab. Because the cells in some columns may contain multiple lines, specify master columns for line separation, and select **Use master columns to detect rows**.

    Specify the **Total** column first, because it always contains data and has one line of data per table record. If this column is not detected on the image, specify the **Unit Price** and **Quantity** columns as the next line-separation option. Use the <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" /> button to select these columns.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial4_8_3_.PNG?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=d99574eef5ef1d5016f41d5be1001b5a" alt="Screenshot of the Rows tab of the InvoiceTable Table element properties in ABBYY FlexiLayout Studio, showing Use master columns to detect rows selected with the Total, Unit Price, and Quantity columns specified as master columns for row separation." width="431" height="455" data-path="images/flexi-capture/fls/tutorial4_8_3_.PNG" />
    </Frame>
  </Step>

  <Step title="Limit the table on the right">
    Click the **Relations** tab. Because the table columns of interest are to the left of the **Sales** column name, add this search constraint:

    * Left of the `TableHeader.kwSales` element, **Offset** = 0.

    <Tip>
      For poor-quality images (for example, noise between the body and footer of the table, or a missing header or footer), you can specify upper and lower table limits. Use the **kwDesignation** element as the upper limit and the **Paragraph** element as the lower limit. On the **Relations** tab, add these search constraints:

      * Below the upper boundary of the **kwDesignation** element, **Offset** = -50, **Reference boundary** = **Top**.
      * Above the **Paragraph** element, **Offset** = -50, **Reference boundary** = **Bottom**.
    </Tip>
  </Step>

  <Step title="Match and check the Quantity column">
    Match the FlexiLayout with the test images. FlexiLayout Studio correctly detects the table element on all the images, but on some images the **Quantity** column includes redundant text from the preceding column. To separate the good data in the **Quantity** column from the irrelevant data, specify the content type for this column.
  </Step>

  <Step title="Set the Quantity content type">
    Open the **Properties** dialog box of the **InvoiceTable** table element. Click the **Columns** tab, open the **Properties...** dialog box of the **Quantity** column, and select the **Check content type** option. In **Type of column content**, select **Number**.

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial4_8_4_.PNG?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=c646cd956bf3591f3505ebe3395c886e" alt="Screenshot of the Quantity column properties in ABBYY FlexiLayout Studio, showing the Check content type option selected with Number chosen as the type of column content." width="462" height="377" data-path="images/flexi-capture/fls/tutorial4_8_4_.PNG" />
    </Frame>
  </Step>

  <Step title="Set the currency content types">
    Match the FlexiLayout again and confirm that the **Quantity** column contains only digits, as required. Similarly, specify the **Currency** content for the **UnitPrice** and **Total** columns.
  </Step>

  <Step title="Set the block source element">
    To specify the location of the **InvoiceTable** block, select the **Source element** option, click <img src="https://mintcdn.com/abbyy/fmgRWFNHKYN2MLSg/images/flexi-capture/fls/Browse_Button.gif?s=3673db30dda4a3293aec716853588b55" alt="Browse button" style={{display:"inline-block",verticalAlign:"middle",margin:0}} width="21" height="20" data-path="images/flexi-capture/fls/Browse_Button.gif" />, and specify **InvoiceTable** as the source element.
  </Step>
</Steps>
