> ## 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 10: Company field, CompanyGroup Group element, Company element

> Detect the Company field in FlexiLayout Studio Sample 4 using a Static Text element that searches a dictionary file within the first third of page one.

After you analyze the images, you will notice that the **Company** field is always in the first third of the first page of each document.

To search for the **Company** field, use a [Static Text](/flexi-capture/fls/template/static-text) element inside a **CompanyGroup** [Group](/flexi-capture/fls/template/elements-compound) element.

## Create the CompanyGroup group element

Create a [Group](/flexi-capture/fls/template/elements-compound) element, name it **CompanyGroup**, and keep the default settings.

## Create the Company element

<Steps>
  <Step title="Create the Static Text element">
    In the **CompanyGroup** element, create a [Static Text](/flexi-capture/fls/template/static-text) element and name it **Company**.
  </Step>

  <Step title="Read the search text from a file">
    Click the **Static Text** tab, select **Search text from file**, and specify the path to the `Companies.txt` file (folder `%public%\ABBYY\FlexiCapture\12.0\Samples\FLS\English\Invoice\Dict`).

    <Frame>
      <img src="https://mintcdn.com/abbyy/8aWHPAJyzWmTqglX/images/flexi-capture/fls/tutorial4_10.png?fit=max&auto=format&n=8aWHPAJyzWmTqglX&q=85&s=f26d3ee954f0ed50176ef7762b60386e" alt="Screenshot of the Static Text tab of the Company element properties in ABBYY FlexiLayout Studio, showing the Search text from file option selected with the path to the Companies.txt dictionary file." width="431" height="455" data-path="images/flexi-capture/fls/tutorial4_10.png" />
    </Frame>
  </Step>

  <Step title="Restrict the search area">
    Click the **Advanced** tab. In **Advanced pre-search relations**, specify an additional search constraint: search for the image object in the first third of the first page of the document. In the [FlexiLayout language](/flexi-capture/fls/code/general-code):

    ```text theme={null}
    Above: Page(1).RectGlobal.Top + Page(1).RectGlobal.Height/3;
    ```
  </Step>

  <Step title="Match the FlexiLayout">
    Match the FlexiLayout to confirm that it reliably detects the element on all the images where it occurs.
  </Step>

  <Step title="Handle multi-line company names">
    When you review the matching results, you will notice that FlexiLayout Studio failed to find the company name on some documents. This is because on some documents the text spans two lines, whereas the element properties specify one-line text. To correct this:

    * Open the `Companies.txt` file and specify the company name as `YOUR SERVICE` with spaces, so FlexiLayout Studio looks for a phrase that may span more than one line.
    * Open the **Properties** dialog box of the **Company** element and click the **Static Text** tab.
    * Select **Permit multiple lines**, so the phrase can be written on more than one line.
    * Set **Line break penalty** to 1, to retain the quality of the generated hypothesis even when the text spans more than one line. A smaller value would penalize the hypothesis.
  </Step>

  <Step title="Verify the match">
    Match the FlexiLayout to confirm that FlexiLayout Studio reliably detects the element on the test images.
  </Step>

  <Step title="Set the block region">
    Specify the location of the **Company** block as the rectangular region of the **Company** element expanded by 5 dots vertically and horizontally. Select **Expression** and specify this expression:

    ```text theme={null}
    Rect outputRect;
    outputRect = CompanyGroup.Company.Rect;
    IsNull = CompanyGroup.Company.IsNull;
    OutputRegion = outputRect;
    OutputRegion.Inflate (5dt, 5dt);
    ```
  </Step>
</Steps>
