> ## 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 have been made, you can search for the Invoice Table field by creating a Table element:

1. **Header** of the table. As decided earlier, specify column names using already detected auxiliary elements.
2. **Footer** of the table. As decided earlier, the **Footer** is specified using the already detected required element **Paragraph** 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.
3. Search area for the table. You can limit the search area on the right using the name of the last **Sales** column, which is not needed for any other purposes.

## Create the InvoiceTable element

To create an InvoiceTable element:

1. In the **SearchElements** tree, create an element of type Table and name it **InvoiceTable**.
2. Click the Columns tab.
3. Click **Select** to select the **InvoiceTable** block created earlier in [Step 3](/flexi-capture/fls/tutorial4/4step3) as the block to search for.
4. Specify the search parameters for the table columns:
   * In the list of columns, select **Reference** and click the Properties... button.\
     For the name of this column, use the previously detected `TableHeader.kwReference` element. To use it, select Use found element as column name, and then 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 `TableHeader.kwReference`.
   * In the list of columns, select **Designation** and click the Properties... button.\
     For the name of this column, use the previously detected `TableHeader.kwDesignation` element.
   * In the list of columns, select **Unit** and click the Properties... button.\
     For the name of this column, use the previously detected `TableHeader.kwUnit` element.
   * In the list of columns, select **Quantity** and click the Properties... button.\
     For the name of this column, use the previously detected `TableHeader.kwQuantity` element.
   * In the list of columns, select **UnitPrice** and click the Properties... button.\
     For the name of this column, use the previously detected `TableHeader.kwUnitPrice` element.
   * In the list of columns, select **Total** and click the Properties... button.\
     For the name of this column, use the previously detected `TableHeader.kwTotal` element.
5. Click the Order tab.
6. Since the columns being searched for may be separated from one another by other columns (for example, **ExtraQtyTag**), but their order is always fixed (first **Designation**, next **Unit Price**, next **Total**), select Rules for column order, click Add..., and add the columns in the following 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>

7. Click the Header tab. The Header of the table is needed, but no additional constraints are imposed, so keep the default values.
8. Click the Footer tab. Use the previously detected element `InvoiceFooter.Paragraph` 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 then 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>

9. Click the Rows tab.
10. Since the cells in some of the columns may contain multiple lines, you need to specify master columns for line separation. Select Use master columns to detect rows.

    First specify the **Total** column, as this column always contains data and for each table record this column has one line of data.

    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>

11. Select the Relations tab. Since the table columns of interest are located to the left of the name of the **Sales** column, add the following search constraints:

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

    <Tip>
      For poor quality images (for example, there is noise between the body and footer of the table, or there is no header or footer) you may specify upper and lower table limits. In this case, you can use the **kwDesignation** element as an upper limit and the **Paragraph** element as the lower limit. On the Relations tab, add the following 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>

12. Match the FlexiLayout with the test images.\
    You will notice that the program correctly detects the table element on all the images, but on some of the images the **Quantity** column includes redundant text from the preceding column.\
    To separate the good data in the **Quantity** column from irrelevant data, specify the type of content for this column.

13. Open the **Properties** dialog box of the table element **InvoiceTable**.\
    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>

14. Now if you match the FlexiLayout on the images, you will see that the **Quantity** column contains only digits, as required.
15. Similarly, specify the Currency content for the **UnitPrice** and **Total** columns.
16. 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.
