TEXTFILLファンクションは、テキスト値の書式を再設定して、現行の書式にかかわらず指定した幅の行に収めるファンクションです。TEXTFILLは通常、行の幅に統一性がなく右側に不必要な余白があるテキストや、特に幅の大きい行があるテキストの書式を再設定する際に使用されます。
注意: TEXTFILLは書式の再設定時にテキストの行を結合します。それに対し、ROWおよびREPORTは行を結合せずに書式を再設定します。例8-133「ROWにおけるTEXTFILLの影響」を参照してください。 |
戻り値
TEXTまたはNTEXT
構文
TEXTFILL(text-expression, width)
引数
データの現行の書式にかかわらず、指定した幅に書式を再設定する対象のテキスト式。TEXT式を指定すると、戻り値はTEXTです。NTEXT式を指定すると、戻り値はNTEXTです。
データの書式が再設定される幅。1
から132
までのINTEGER
値として指定します。
構造化されたレポートでは、指定された幅がレポートの列の幅を超えないかぎり、TEXTFILLはtext-expressionの書式をその幅に再設定します。widthの値が列の幅を超える場合、TEXTFILLはそれを無視し、式の書式は列の幅に再設定されます。
TEXTFILLは、単語間に空白を1つのみ配置して余分な空白を削除することにより、text-expressionの単語をできるだけ多く1行に収めます。単語がwidthより長い場合、TEXTFILLは2行以上に分割します。この場合、行の最後に余分な空白が配置されることがあります。
例
例8-133 ROWにおけるTEXTFILLの影響
次の例は、適切に書式が設定されたテキスト変数textvar
を使用して、ROWコマンド内でTEXTFILLを使用した場合の影響を示しています。
次の文を発行します。
SHOW textvar
生成される出力は次のとおりです。
You can use the following options to control the format of your display. BMARGIN Controls the bottom margin. COLWIDTH Controls column width. COMMAS Controls the use of commas in numbers. DECIMALS Controls number of decimal places in numbers. LSIZE Controls the maximum length of a line. NASPELL Controls the spelling of NA values in output.
次のROW文を実行します。
ROW W 50 textvar
生成される出力は次のとおりです。
You can use the following options to control the format of your display. BMARGIN Controls the bottom margin. COLWIDTH Controls column width. COMMAS Controls the use of commas in numbers. DECIMALS Controls the number of decimal places in numbers. LSIZE Controls the maximum length of a line. NASPELL Controls the spelling of NA values in output.
それに対して、次のようにTEXTFILLを指定してROW文を実行します。
ROW W 50 TEXTFILL(textvar, 50)
生成される出力は次のとおりです。
You can use the following options to control the format of your display. BMARGIN Controls the bottom margin. COLWIDTH Controls column width. COMMAS Controls the use of commas in numbers. DECIMALS Controls the number of decimal places in numbers. LSIZE Controls the maximum length of a line. NASPELL Controls the spelling of NA values in output.