Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to save a report to a .xls
Message
De
20/03/2002 09:09:40
 
 
À
19/03/2002 23:19:32
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00634777
Message ID:
00634917
Vues:
23
>I need to generate a report from VFP and save that report to a excel format files. How can I do this?

Linda:

As has been said in this thread, you can use COPY TO ... XLS from the cursor or table that contains your report data. This is fast enough but has a couple of problems:

- It creates an older format of Excel. That is solved by opening the file in Excel and saving it with a newer XLS format.
- It has a limitation of 16535 rows.

If you have more rows that that there are other ways to do it.

You could use COM Automation (as Hilmar pointer out), to open and manipulate the file directly in Excel programmatically. You could send each row to Excel independently. This gives you excellent control but it's slow.

You could save the data to a txt or csv file and load it into Excel. Much faster but beware that Excel will understand only the first 15 digits of a numeric field and replace the rest with zeroes. So if you have something like account numbers as numeric (as some people do), you can get into problems. There are ways around this too as always <g>.

Hope this gets you started.

Check:
"Microsoft Office Automation with Visual FoxPro" by Tamar E. Granor and Della Martin
http://www.hentzenwerke.com/catalogavailability/autofox.htm

and examples in the Wiki:
http://fox.wikis.com/wc.dll?Wiki~AutomationExamples~VFP


Alex Feldstein, MCP, Microsoft MVP
VFP Tips: English - Spanish
Website - Blog - Photo Gallery


"Once again, we come to the Holiday Season, a deeply religious time that each of us observes, in his own way, by going to the mall of his choice." -- Dave Barry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform