Display a literal block of text
TEXT [TO PRINTER] [TO FILE <xcFile>] <text>... ENDTEXT
<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.
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().
. 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
?|??, @…SAY, MEMOLINE(), MLCOUNT(), SET CONSOLE