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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Data 1

Status
Not open for further replies.

progfox

Programmer
Jun 15, 2003
43
IN
Sir

I want to export data to MS Excel from foxpro queries. The best way of doing that by Go file menu. and perform few tasks and u exports the things very easily. I want to perform the activity with help of click command.


I any possibilities are there then do give the solution with codes.



Thanx & regards


Chandan
 
Hi


SELECT * .... whatever to extract the records..
INTO CURSOR myCursor....
EXPORT TO myFile TYPE XL5
OR
EXPORT TO myFile TYPE XLS

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Tahnks for ur reply Sir. Iahev got one query more. Actually I was trying this becase I want to mail my reports. Actually U know sir Its ine way of doing is to convert the cursor in XLS and then mail the same as an attachment. What actually Iam trying that to mail the report in its original format.

Well again thanks for showing interest in my quary.

If U find any solution for the above query then pls provide me the solution.


Thanking U

Chandan
 
Hi Chandan,

for sending the report as email attachment, you have number of ways to do the same.

1. You can send the REPORT to a text file
myFile = "c:\myDir\myTxtFile.txt"
REPORT FORM myReport.... NOCONSOLE TO FILE (myFile) ASCII
Then attach the myTxtFile.txt as an attachment to email.

2. If the report is not a txt type file, you can automate PDF generation. PDF creation is quite easy with some freeware utilities available (even the installation is automatic and no PDF writer is required - you can check in universalThread.com). Then attach the PDF to your email where any one can view it easily using PDF viewer available almost with every one.

3. Still another way is to save the report as HTM file, gaining popularity these days and use the IE to view the report.

4. Yet another way is export the report to word doc type file. But I dont recommend this. This is more complicated that export to xls type which you are doing but relatively simpler.

I would go with 1 or 2 above while I still do 3 at tiomes.

If you want the user to modify the report.. Txt type is easier. If you want user to recompute etc. on the generated report, XLS type is better. If you simply want users to view as it would appear in a report.. PDF is the best.

:)

____________________________________________
ramani - (Subramanian.G) :)
 
Hi Chandan,

If you need to have the report in Excel, and you need to have certain formating, you can do it a couple of ways.

1. Try the Export and COPY TO options others provided

2. If it's not a lot of data, you can use "automation" to have VFP communicate directly with Excel and put the data in. If you chose this method, you may wish to open a blank spreadsheet, format all the columns, headers, etc., and then save it as a template. Open this template and use automation to place the data into the sheet. It sounds complicated, but it's not. Take a look at faq184-4428 Excel - How to do Automation from VFP

Copy the sample code into a prg and run it. It will give you and idea.

3. Use a combination of the 2 approaches. a) copy the data as in item (1) b) Open the spreadsheet that contains this data and use automation to handle just the formatting.



Jim Osieczonek
Delta Business Group, LLC
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top