FoxPro/pl. help for program
can you create a program for me for simple text file reading and getting desired output.i.e.desired characters column wise in excel sheet.
thanks in advance.
Although an excel spreadsheet can be directly accessed with FoxPro if the appropriate ODBC driver is installed, I don't know if you have that capability. However, there is an easy way to access the data without it; convert the file to a database format. The conversion can be done from within either program...
Using the Excel menu, select: "File" Then, "Save As..."
From the "Save as" dialog box, select the output file type as .DBF (I believe the option specifies "dBase database," but I don't have Excel installed to confirm this.)
(NOTE: You didn't specify your version, but if you are using a recent version of Visual FoxPro, it will prompt you to do a one-time conversion when you USE the file.)
Create an empty FoxPro table with a field structure to match to columns in the spreadsheet.
(NOTE: Columns with dates should be created as "Character" fields in the structure to avoid conversion issues.)
Once created, add records to it with the APPEND FROM command:
APPEND FROM <filename.xls> TYPE XL5
APPEND FROM <filename.xls> TYPE XLS
Whether you use XL5 or XLS depends on the version of the Excel file. Try the XL5 first, it will work in most cases. If the file is a very old version of Excel, maybe XLS will work if the first one fails.
When the table is ready (from either method), simply open it as any other FoxPro table to produce your report.