English (English) - Change language

Sample 4. Step 8: Table element, InvoiceTable element

Now that all the preparations have been made we can search for the Invoice Table field by creating a Table element:

  1. Header of the table. As decided earlier, we will specify column names using already detected auxiliary elements.
  2. Footer of the table. To specify the Footer, we decided to use an already detected required element Paragraph from the InvoiceFooter group, which identifies the beginning of the final part. We described this element as the closest to the bottom of the table.
  3. Search area for the table. We can limit the search area on the right using the name of the last Sales column, which we do not need for any other purposes.

To create an InvoiceTable element:

  1. In the SearchElements tree, create and element of type Table and name it InvoiceTable.
  2. Click the Columns tab
  3. Click Select to select the previously created (see Step 3) InvoiceTable block as the block to search
  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, we will use the previously detected TableHeader.kwReference element. To use it, select Use found element as column name, then click and select TableHeader.kwReference.
    • In the list of columns, select Designation and click the Properties... button.
      For the name of this column, we will 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, we will 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, we will 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, we will 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, we will use the previously detected TableHeader.kwTotal element.
  5. Click the Order tab.
  6. Since the columns we are looking for may be separated from one another by other columns (e.g. 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.

    Show me...

  1. Click the Header tab. We need the Header of the table, but we do not need to impose any additional constraints, so keep the default values.
  2. Click the Footer tab. We will use the previously detected element InvoiceFooter.Paragraph for the final part of the table. Select the Use found element as footer option, click and then select the InvoiceFooter.Paragraph element.

    Show me...

  1. Click the Rows tab.
  2. Since the cells in some of the columns may contain multiple lines, we 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. In case this column is no detected on the image, specify the Unit Price and Quantity columns as the next line separation option. Use the button to select these columns.

    Show me...

  1. Select the Relations tab. Since the table columns we are interested in 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;
      Note.For poor quality images (e.g. 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, we 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.
  2. 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, we will specify the type of content for this column.
  3. 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.

    Show me...

  1. Now if you match the FlexiLayout on the images, you will see that the Quantity contains only digits, which is what we need.
  2. Similarly, specify the Currency content for the UnitPrice and Total columns.
  3. To specify the location of the InvoiceTable block, select the Source element option. Click and specify InvoiceTable as the source element.

15.09.2020 9:42:43


Please leave your feedback about this article