Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting To A Text File With Column Headers

Status
Not open for further replies.

edrossi

Programmer
Jan 24, 2002
42
US
I have run into a project where it is necessary for me to include column headers on a text file export from VFP. Is this possible and are there any limitations?

Thanks in advance for the help.
 
D'oh! This is always something which used to come up when people required headers for export from my old direct marketing days!

As of yet the best way (I have found) is to export to your text file, then open it using low level fopen() and literally iterate through each field in your table using the AFIELDS(array,alias) command and create a text string from it. Separate your field names with whatever delimiter you like and insert the row into your text file using Fputs()

There should be a parameter for it on the copy to clause don't you think?

Derren
 
HI

1. Create a report form as you would want it to print.. with header etc,
2. To direct the report to a text file..
REPORT FORM myReportForm TO FILE "myTextFile.txt" ASCII
Hope this helps you :) ramani :-9
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Try:

USE MyTable
LIST OFF TO MyFile.TXT NOCONSOLE

This will export the file to text. It won't export memo fields though, just "memo" or "Memo" depending on whether or not the memo field has data in it.

Dave S.
 
Hi,

use table
copy to filename.csv type csv
it´s a comma seperated Value or you have to rename it, after exporting, to filename.txt

Greatings from Germany
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top