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
\<html>
\<head>
\<title>HTML from FoxPro</title>
\</head>

*-- Now for the body
\<body>

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

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

*-- Closing tags for the html page
\</body>
\</html>

*-- 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.

Related Items

FoxPro TextMerge

Using TextMerge to export text, html or xml files from FoxPro.

Read More

Exporting files to the desktop

Saving files on the Windows desktop with FoxPro.

Read More

Exporting from FoxPro to text files.

Export FoxPro data to comma separated and other types of delimited text files

Read More