How to Perform a Text Merge Without Using Memo Fields

Last reviewed: November 19, 1995
Article ID: Q100550
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


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: November 19, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.