TEXT

TEXT*

Display a literal block of text

Syntax

      TEXT [TO PRINTER] [TO FILE <xcFile>]
            <text>...
         ENDTEXT

Arguments

<text> is the block of literal characters to be displayed to the screen. Text is displayed exactly as formatted.

TO PRINTER echoes the display to the printer.

TO FILE <xcFile> echoes the display to the specified file. <xcFile> may be specified as a literal file name or as a character expression enclosed in parentheses. If no extension is specified, .txt is assumed.

Description

TEXT…ENDTEXT is a console command construct that displays a block of text to the screen, optionally echoing output to the printer and/or a text file. To suppress output to the screen while printing or echoing output to a file, SET CONSOLE OFF before the TEXT command line.

Text within the TEXT construct displays exactly as formatted, including any indentation. Hard carriage returns are output as new lines, soft carriage returns as the character CHR(141). Macro variables found within TEXT…ENDTEXT are expanded. However, macro expressions are not.

TEXT…ENDTEXT is a compatibility command and not recommended. Clipper has other facilities for text processing and output. For example, MEMOLINE() in combination with MLCOUNT() can word wrap long strings according to a specified line length. ? or @…SAY can display formatted text extracted from a long string with MEMOLINE().

Examples

      .  This example demonstrates how to use TEXT...ENDTEXT to print a
         form letter:

      USE Sales NEW
      DO WHILE !EOF()
         FormLetter()
         SKIP
      ENDDO
      RETURN

      FUNCTION FormLetter
         LOCAL dDate := DTOC(DATE()), cSalesman := ;
                  RTRIM(Salesman)
         TEXT TO PRINTER
         &dDate.
         Dear &cSalesman.,
         How are you!
         ENDTEXT
         EJECT
         RETURN NIL

Seealso

?|??, @…SAY, MEMOLINE(), MLCOUNT(), SET CONSOLE

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.