Microsoft KB Archive/100550

From BetaArchive Wiki

How to Perform a Text Merge Without Using Memo Fields

ID: Q100550

2.50 2.50a | 2.00 2.50 2.50a

WINDOWS    | MS-DOS

kbprint The information in this article applies to:

  • Microsoft FoxPro for Windows, versions 2.5, 2.5a
  • Microsoft FoxPro for MS-DOS, versions 2.0, 2.5, 2.5a

SUMMARY

The text merge feature in FoxPro provides a powerful method for developing documents, as illustrated by the example below, which shows how to perform a text merge that doesn't involve using memo fields.

MORE INFORMATION

In this example, all text and components to be merged with the text are contained in a program (.PRG) file. Page spacing (top, bottom and side margins) are all controlled within the program (specifically, within the TEXT ... ENDTEXT structure). The sample code below prints a letter.

The fields to be evaluated are contained in the database file FOXPRO2\SAMPLE\DBFS\CLIENTS.DBF in FoxPro version 2.0 for MS-DOS. CLIENTS.DBF is found in FOXPRO25\SAMPLE\DBFS in FoxPro versions 2.5 and 2.5a for MS-DOS and in FOXPROW\SAMPLE\ORGANIZE\DBFS in FoxPro versions 2.5 and 2.5a for Windows.

   CLEAR                        && clears screen
   SET PRINTER ON
   SET TEXTMERGE ON             && enables evaluation of components
   SET TALK OFF                 && prevents printing of commands
   SET TEXTMERGE DELIMITERS TO  && sets default delimiters
   USE C:\Foxpro2\Sample\Dbfs\Clients  && fully qualified filename
   * for version 2.0 for MS-DOS.
   * CLIENTS.DBF is found in FOXPRO25\SAMPLE\DBFS in 2.5 and 2.5a
   *  for MS-DOS.
   * CLIENTS.DBF is found in FOXPROW\SAMPLE\ORGANIZE\DBFS in 2.5
   *  and 2.5a for Windows.
   SCAN
   TEXT                         && begins text merge process
         <<DATE()>>

         <<ALLTRIM(PROPER(CONTACT))>>
         <<ALLTRIM(PROPER(COMPANY))>>
         <<ALLTRIM(PROPER(ADDRESS))>>
         <<ALLTRIM(PROPER(CITY))>>, <<ALLTRIM(STATE)>>  <<ALLTRIM(ZIP)>>

         Dear <<ALLTRIM(PROPER(CONTACT))>>:

         This area includes the body of a letter to be sent to the
         contact.

         Sincerely,

         Your name

    ENDTEXT
    CLEAR
    ENDSCAN
    SET PRINTER TO
    SET PRINTER OFF

For more information about performing text merges, see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q97163
   TITLE     : General Text Merge Functionality

Additional reference words: FoxDos FoxWin 2.00 2.50 2.50a 2.x textmerge KBCategory: kbprint KBSubcategory: FxprintGeneral

Keywords          : FxprintGeneral 
Version           : 2.50 2.50a | 2.00 2.50 2.50a
Platform          : MS-DOS WINDOWS

Last Reviewed: November 20, 1995
© 1999 Microsoft Corporation. All rights reserved. Terms of Use.