General information
Category:
Reports & Report designer
>In this months FoxPro Advisor there is an article for sending memo files to an Excel Spreadsheet. That got me thinking....
>
>One of the Class Libraries in VFP 6 allow you to send a report to the screen, the printer or a .txt file which by the way is really worthless! So... What if instead of sending it to a .txt, why not a .csv or xl spreadsheet file so the user can do what he/she wants with the data. Thus far we have drawn a blank as to how to accomplish this. Any ideas or know solutions would be much appreciated.
Well, there are many ways to get data into a spreadsheet -- but going directly from the Report Writer to Excel isn't one of them (unless you're running Crystal Reports, which can export to Excel). You mentioned .CSV or an Excel file -- COPY TO supports both TYPE XL5 and the abilitty to create a comma delimited file. If you've formatted your reports to run from a single (usually non-normalized) table, it may be formatted well enough for the user that you can easily use COPY TO to get it into an Excel file. Otherwise, just build a cursor with what you want the user to see, and COPY TO an Excel file.
Once you've got the XL5 or the CSV file, it's quite easy to use Automation open the file in Excel for the user, and then you can even format it nicely for them. You can also use Automation to directly push data into cells (though the drawback is that it's a lot slower than COPY TO...TYPE XL5 and opening it in Excel for large amounts of data).
Hope this helps,
- della Martin
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only