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

# グローバル関数

> FlexiLayout languageで利用できるすべてのグローバル関数を網羅したリファレンス。

<div id="operations-with-areas">
  ## 領域に対する演算
</div>

| Function                                                | Description                                                                                                                     |
| :------------------------------------------------------ | :------------------------------------------------------------------------------------------------------------------------------ |
| `Area Max( Area a1, Area a2 )`                          | a1 と a2 のうち大きい方を返します。                                                                                                           |
| `Area Min( Area a1, Area a2 )`                          | a1 と a2 のうち小さい方を返します。                                                                                                           |
| `Area ObjectsArea( Rect, ImageObjectType )`             | 指定した Rectangle 内の、指定した種類のオブジェクトの面積を返します。グローバル座標で動作します。                                                                          |
| `Area ObjectsIntersectionArea( Rect, ImageObjectType )` | 指定した Rectangle 内の、指定した種類のオブジェクトの面積を返します。オブジェクトの面積が指定した Rectangle をはみ出す場合は、オブジェクトの面積と指定した Rectangle の交差領域の面積を返します。グローバル座標で動作します。 |

<div id="operations-with-distances">
  ## 距離に関する操作
</div>

| Function                                   | Description                                                                                                                                              |
| :----------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Distance Abs( Distance )`                 | 距離の絶対値を返します。                                                                                                                                             |
| `Distance AverageInterLineInterval()`      | ページ上のテキスト行の平均高さを返します。この関数は、ドキュメント内のページ数の最小値と最大値が 1 に設定されている場合にのみ使用できます。複数ページのドキュメントの場合は、Page 型の対応するメソッドを使用してください: `Page( N ).AverageLineHeight`。         |
| `Distance AverageLineHeight()`             | ページ上のテキスト行間の平均距離を返します。この関数は、ドキュメント内のページ数の最小値と最大値が 1 に設定されている場合にのみ使用できます。複数ページのドキュメントの場合は、Page 型の対応するメソッドを使用してください: `Page( N ).AverageInterLineInterval`。 |
| `Distance Min( Distance d1, Distance d2 )` | d1 と d2 のうち小さい方の値を返します。                                                                                                                                  |
| `Distance Max( Distance d1, Distance d2 )` | d1 と d2 のうち大きい方の値を返します。                                                                                                                                  |

<div id="operations-with-numeric-data-types">
  ## 数値データ型の演算
</div>

| Function                       | Description             |
| :----------------------------- | :---------------------- |
| `Int abs( Int )`               | 数値の絶対値を返します。            |
| `Int Ceil( Real )`             | 引数以上で最小の整数を返します。        |
| `Int Floor( Real )`            | 引数以下で最大の整数を返します。        |
| `Int Max( Int n1, Int n2 )`    | n1 と n2 のうち大きい方の値を返します。 |
| `Int Min( Int n1, Int n2 )`    | n1 と n2 のうち小さい方の値を返します。 |
| `Int Round( Real )`            | 引数に最も近い整数を返します。         |
| `Real Min( Real d1, Real d2 )` | d1 と d2 のうち小さい方の値を返します。 |
| `Real Max( Real d1, Real d2 )` | d1 と d2 のうち大きい方の値を返します。 |

<div id="operations-with-rectangles-and-regions">
  ## Rectangle と Region の操作
</div>

| 関数                                                            | 説明                                                                  |
| :------------------------------------------------------------ | :------------------------------------------------------------------ |
| `Rect DocumentRect()`                                         | ドキュメント全体の矩形（グローバル座標系）を返します。                                         |
| `Rect PageRect()`                                             | 画像全体の矩形を返します。この関数は、ドキュメント内のページ数の最小値と最大値がいずれも 1 に設定されている場合にのみ使用できます。 |
| `Region FormRegion( RectArray included, RectArray excluded )` | included の矩形配列を取り込み、excluded の矩形配列を除外する Region を作成します。              |

<div id="string-operations">
  ## 文字列操作
</div>

<table width="100%">
  <tbody>
    <tr><td><p><strong>関数</strong></p></td><td><p><strong>説明</strong></p></td></tr>
    <tr><td><p>String Chr( Int )</p></td><td><p>指定した文字の Unicode コードを使用して文字列を返します (コードは 10 進数で記述する必要があります) 。</p></td></tr>
    <tr><td><p>String LCase( String )</p></td><td><p>指定した文字列内のすべての文字を小文字に変換した文字列を返します。</p></td></tr>
    <tr><td><p>String RealToStrVariants( Real value, String fractionalPartSeparators, Int maxDigitsCountInFractionalPart = 2 )</p></td><td><p>指定した実数 "value"、小数点の区切り文字 fractionalPartSeparators、および小数部の最大桁数に基づいて、縦棒 ("|") で区切られた文字列表現を作成します。たとえば、引数が 19、".,"、2 の場合、結果は "19|19.0|19.00|19,0|19,00" になります。</p></td></tr>
    <tr><td><pre><code>String Str( Int )<br />String Str( Logic )<br />String Str( Real )<br />String Str( XInterval )<br />String Str( YInterval )<br />String Str( DistInterval )<br />String Str( FuzzyRect )<br />String Str( Hypothesis )<br />String Str( RectArray )<br />String Str( Region )<br />String Str( Area )<br />String Str( Quality )<br />String Str( Distance )<br />String Str( PageInterval )</code></pre></td><td><p>データ型の文字列表現を返します。</p></td></tr>
    <tr><td><p>String RemoveSpaces( String )</p></td><td><p>指定した文字列からすべての空白を削除した文字列を返します。</p></td></tr>
    <tr><td><p>String UCase( String )</p></td><td><p>指定した文字列内のすべての文字を大文字に変換した文字列を返します。</p></td></tr>
  </tbody>
</table>

<div id="access-to-xml-files">
  ## XML ファイルへのアクセス
</div>

| Function                                                               | Description                                                                                                                                                                                                   |
| :--------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `StringArray ReadFromXML( String filename, String xPathQuery )`        | "filename" の XML ファイルから文字列配列を読み込みます。文字列は、渡された xPath クエリ "xPathQuery" を評価して取得します。XML ファイルの使用方法の詳細は User Dictionaries を参照してください。**注:** コードをわかりやすくするため、頻繁に使用する xPath クエリに対して置換可能な引数を含む定数を定義し、その定数を関数呼び出しで使用できます。 |
| `String ReadSingleStringFromXML( String filename, String xPathQuery )` | "filename" の XML ファイルから 1 つの文字列を読み込みます。文字列は、渡された xPath クエリ "xPathQuery" を評価して取得します。XML ファイルの使用方法の詳細は User Dictionaries を参照してください。                                                                             |

<div id="type-conversion-and-checks">
  ## 型変換とチェック
</div>

<table width="100%">
  <tbody>
    <tr><td><p><strong>関数</strong></p></td><td><p><strong>説明</strong></p></td></tr>
    <tr><td><p>Logic IsReal( String numberString, String separators = ".,", Logic isStrictMode = false )</p></td><td><p>入力文字列を安全に実数へ変換できるかどうかを確認します。使用できる小数区切り文字の一覧は、"separators" 引数で設定します。</p></td></tr>
    <tr><td><p>Logic IsRealFuzzy( String, String separators = defaultDecimalSeparators, Logic isStrictMode = false )</p></td><td><p>文字列内で起こり得る認識エラーを考慮して、入力文字列を安全に実数へ変換できるかどうかを確認します。</p></td></tr>
    <tr><td><p>Logic IsInt( String inputString, Logic isStrictMode = false )</p></td><td><p>入力文字列を安全に整数へ変換できるかどうかを確認します。</p></td></tr>
    <tr><td><p>Logic IsIntFuzzy( String inputString, Logic isStrictMode = false )</p></td><td><p>文字列内で起こり得る認識エラーを考慮して、入力文字列を安全に整数へ変換できるかどうかを確認します。</p></td></tr>
    <tr><td><p>Real StrToRealFuzzy( String, String separators = defaultDecimalSeparators, Logic isStrictMode = false )</p></td><td><p>起こり得る認識エラーを考慮して、入力文字列の値を実数に変換した結果を返します。</p></td></tr>
    <tr><td><p>Real StrToReal( String numberString, String separators = ".,", Logic isStrictMode = false )</p></td><td><p>入力文字列を実数に変換した結果を返します。空白は無視されます。</p><details><summary>例</summary><pre><code>Real realValue;<br />String valueFromDocument = SearchElements.StaticText.Value();<br />Logic canBeConverted = IsReal(valueFromDocument, ".");<br />if(canBeConverted) then realValue = StrToReal(valueFromDocument, ".");</code></pre></details></td></tr>
    <tr><td><p>Int StrToInt( String inputString, Logic isStrictMode = false )</p></td><td><p>入力文字列の値を整数に変換した結果を返します。空白は無視されます。</p><details><summary>例</summary><pre><code>Int integralValue;<br />String valueFromDocument = SearchElements.StaticText.Value();<br />Logic canBeConverted = IsInt(valueFromDocument, true);<br />if(canBeConverted) then integralValue = StrToInt(valueFromDocument, true);</code></pre></details></td></tr>
    <tr><td><p>Int StrToIntFuzzy( String, Logic isStrictMode = false )</p></td><td><p>起こり得る認識エラーを考慮して、入力文字列の値を整数に変換した結果を返します。</p></td></tr>
    <tr><td><p>Int LogicToInt( Logic value )</p></td><td><p>値が <code>true</code> の場合は "1" を、<code>false</code> の場合は "0" を返します。</p></td></tr>
  </tbody>
</table>

<div id="operations-with-coordinates">
  ## 座標に関する操作
</div>

| Function                                                            | Description                                         |
| :------------------------------------------------------------------ | :-------------------------------------------------- |
| `XCoordinate Min( XCoordinate x1, XCoordinate x2 )`                 | x1、x2 のうち小さい方の値を返します。                               |
| `XCoordinate Max( XCoordinate x1, XCoordinate x2 )`                 | x1、x2 のうち大きい方の値を返します。                               |
| `XCoordinate MiddleBetween( XCoordinate x1, XCoordinate x2 )`       | ( x1 + x2 ) / 2 として計算された X 座標を返します。                 |
| `XCoordinate Between( XCoordinate x1, XCoordinate x2, Real ratio )` | x1 + ( x2 – x1 ) \* ratio として計算された X 座標を返します。       |
| `YCoordinate Min( YCoordinate y1, YCoordinate y2 )`                 | y1、y2 のうち小さい方の値を返します。                               |
| `YCoordinate Max( YCoordinate y1, YCoordinate y2 )`                 | y1、y2 のうち大きい方の値を返します。                               |
| `YCoordinate MiddleBetween( YCoordinate y1, YCoordinate y2 )`       | ( y1 + y2 ) / 2 として計算された Y 座標を返します。                 |
| `YCoordinate Between( YCoordinate y1, YCoordinate y2, Real ratio )` | y1 + ( y2 – y1 ) \* ratio として計算された Y 座標を返します。       |
| `XInterval MiddleBetween( Xinterval x1, XInterval x2 )`             | ( x1 + x2 ) / 2 として計算された XInterval を返します。           |
| `XInterval Between( Xinterval x2, Xinterval x2, Real ratio )`       | x1 + ( x2 – x1 ) \* ratio として計算された XInterval を返します。 |
| `YInterval MiddleBetween( Yinterval y1, Yinterval y2 )`             | ( y1 + y2 ) / 2 として計算された YInterval を返します。           |
| `YInterval Between( Yinterval y1, Yinterval y2, Real ratio )`       | y1 + ( y2 – y1 ) \* ratio として計算された YInterval を返します。 |

<div id="access-to-data-catalogs">
  ## データ カタログへのアクセス
</div>

<Note>
  データ カタログにアクセスするには、まず対象のカタログを参照する Skill Parameter を作成し、その Parameter 名をメソッド呼び出しで使用します。
</Note>

| Function                                                                                                                                                                                                                                      | Description                                                                                                      |
| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------- |
| `Logic TestAccessToCatalog( String catalogParameterName )`                                                                                                                                                                                    | catalogParameterName Parameter で参照されるデータ カタログへのアクセス可否をテストします。                                                    |
| `Logic TestCatalogSearchCriteria( String catalogParameterName, StringArray searchColumns, NamedValueArray searchCriteria )`                                                                                                                   | データ カタログに設定された検索条件の妥当性を確認します。検索条件は名前付き値の配列で指定し、各名前付き値は列名と期待値を表します。searchColumns 配列は、応答に含めるデータ カタログ レコードの列を指定します。 |
| `StringArray FieldNamesOfCatalog( String catalogParameterName )`                                                                                                                                                                              | catalogParameterName Parameter で参照されるデータ カタログ内のすべての列名の一覧を返します。列はインデックス番号の昇順で並びます。                                |
| `StringArray FieldNamesOfCatalog( String catalogParameterName, StringArray searchColumnNames )`                                                                                                                                               | searchColumnNames 配列に含まれる (大文字小文字を区別しない) データ カタログの列名の一覧を返します。列はインデックス番号の昇順で並びます。このメソッドで列インデックスを特定できます。           |
| `Int RecordCountOfCatalog( String catalogParameterName, StringArray searchColumns, NamedValueArray searchCriteria = EmptyNamedValueArray )`                                                                                                   | 指定した検索条件を満たすデータ カタログ内のレコード数を返します。                                                                                |
| `Void PrepareRecordsetOfCatalog( String catalogParameterName, StringArray searchColumns, NamedValueArray searchCriteria = EmptyNamedValueArray, Int maxRecordsCount = 1000 )`                                                                 | 検索条件を満たすデータ カタログのレコードを取得します。                                                                                     |
| `StringArray RecordOfCatalog( String catalogParameterName, StringArray searchColumns, NamedValueArray searchCriteria = EmptyNamedValueArray, Int rowIndex )`                                                                                  | 検索条件を満たすデータ カタログから、指定行のレコードを返します。                                                                                |
| `Quality ValidateByCatalog( String word, String catalogParameterName, Int columnIndex, NamedValueArray searchCriteria = EmptyNamedValueArray, Int maxErrors, Rational maxErrorsPart, Logic ignoreSpaces = true, Int maxRecordsCount = 1000 )` | 指定した文字列 word を、データ カタログ内の列インデックス columnIndex の値と照合して検証します。指定文字列とその列での最良一致との一致品質を返します。                            |
| `Int GetCatalogColumnIndex( String catalogParameterName, String columnName )`                                                                                                                                                                 | catalogParameterName Parameter で参照されるデータ カタログ内で、指定した名前の最初の列インデックスを返します。列名の大文字小文字は区別されません。                        |
| `IntArray GetCatalogColumnIndices( String catalogParameterName, String columnName )`                                                                                                                                                          | catalogParameterName Parameter で参照されるデータ カタログ内で、指定した名前のすべての列インデックスを返します。列名の大文字小文字は区別されません。                       |

<div id="access-to-skill-parameters-of-type-text">
  ## Text 型の Skill Parameter へのアクセス
</div>

| Function                                                   | Description                                                           |
| :--------------------------------------------------------- | :-------------------------------------------------------------------- |
| `Logic NamedParameterStringExists( String parameterName )` | 指定した名前のテキスト Parameter が Skill 内に存在するかを確認します。Parameter 名は大文字小文字を区別します。 |
| `String GetNamedParameterString( String parameterName )`   | 指定した名前のテキスト Parameter の値を返します。Parameter 名は大文字小文字を区別します。               |

<div id="miscellaneous">
  ## その他
</div>

| Function                                       | 説明                                                 |
| :--------------------------------------------- | :------------------------------------------------- |
| `InputFieldArray InputFields()`                | ドキュメント処理の前段階でドキュメント内に見つかったfieldオブジェクトのコレクションを返します。 |
| `Int PagesCount()`                             | ドキュメントのページ数を返します。                                  |
| `Page Page( Int PageNumber )`                  | 指定した番号のページを表すPageオブジェクトを返します。                      |
| `Logic IsOnSameLine( Hypothesis, Hypothesis )` | 2つのHypothesisが垂直方向に交差しているかを判定します。                  |
