Use TextMerge to export FoxPro data

This example exports a simple list of customers to a HTML page:

Use Customer

*-- Start the merge process
*-- Use the noshow option so that no output
*-- shows on screen
Set Textmerge On
Set Textmerge To customer.htm noshow

*-- Just a minimal HTML header for the document
\<title>HTML from FoxPro</title>

*-- Now for the body

*-- Start with a level 1 heading and a line
\<h1>Customer List</h1>
\<hr />

*-- Output one line for each record in the table
   \Company name is <<Upper(Company)>>
   \<br />

*-- Closing tags for the html page

*-- Close the text file and stop merging
Set Textmerge To
Set Textmerge Off
Use In Customer

This short program will produce a text file named 'customer.htm' which looks like this in a browser:

HTML from VFP merge commands

This is a very simple page but even so the mixture of TextMerge and HTML can be confusing to write. Both use the < and > symbols and it's easy to get confused. TextMerge is however a very powerful and flexible technique which lets you build a page which will display a mixture of text and data.