TEXTFILL

The TEXTFILL function reformats a text value to fit compactly into lines of a specified width, regardless of its current format. TEXTFILL is commonly used to reformat text with an unnecessarily ragged right margin or with a bad line width.

Note:

TEXTFILL joins lines of text while reformatting, whereas ROW and REPORT reformat without joining lines. See Example 8-135, "The Effects of TEXTFILL on ROW"

Return Value

TEXT or NTEXT

Syntax

TEXTFILL(text-expressionwidth)

Parameters

text-expression

A text expression to be reformatted to the specified width, regardless of the current format of the data. When you specify a TEXT expression, the return value is TEXT. When you specify an NTEXT expression, the return value is NTEXT.

width

The desired width of the reformatted data, entered as an INTEGER value from 1 to 132.

In a structured report, TEXTFILL reformats text-expression to the width you specify if that width is less than the width of the report column. When width is greater than the column width, it is ignored by TEXTFILL, and the expression is reformatted to the width of the column.

TEXTFILL fits as many words of text-expression as it can onto one line, placing just one space between words and removing extra spaces between words. When a word is longer than width, TEXTFILL breaks it across two or more lines. In this case there may be extra spaces at the end of lines.

Examples

Example 8-135 The Effects of TEXTFILL on ROW

The following example shows the effect of TEXTFILL on a ROW command, using the nicely formatted text variable textvar.

The statement

SHOW textvar

produces the following output.

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.

The ROW statement

ROW W 50 textvar

produces the following output.

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.

By contrast, the ROW statement with TEXTFILL

ROW W 50 TEXTFILL(textvar, 50)

produces the following output.

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.