×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to display an excel report in foxpro?

How to display an excel report in foxpro?

How to display an excel report in foxpro?

(OP)
I have a cursor as 'Absent_xl' and I want to create a excel report using this cursor data. And for this I'm using two options such as, "optexcel and optpdf'.
Whe I'm selecting 'optexcel' I want to display the excel report.
How can I do this?

Thank you

RE: How to display an excel report in foxpro?

VFP does not have any native capability to create an Excel report. But there are ways of exporting a VFP report to Excel.

My preferred option would be to use XFRX. This is a very useful tool for converting a VFP report to several different output formats, including Excel, Word, PDF and others. It is not free, but it is not very expensive. See eqeus.com.

Another option is FoxyPreviewer (which is free). Many developers use it as a substitute for the native VFP report preview. It also offers options for output to Excel, PDF and others. See www.foxypreviewer.com.

For a completely different approach, you could send your data direct to Excel using Automation. However, that's quite a bit more complicated, so I won't give you any detailed information unless you decide to go down that road.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to display an excel report in foxpro?

you could do

CODE

SELECT MYTABLE
COPY TO (M.TEMPDIR+"MYREPORT.XLS") XL5
BROWSER(M.TEMPDIR+"MYREPORT.XLS") 

The function BROWSER() just calls shellexecute if the file specified exists - code below, it calls MyFile as I don't like File()

CODE

FUNCTION BROWSER
	LPARAMETERS m.FILENAME
	LOCAL LNRETVAL, LCOPERATION
	LCOPERATION = "Open"
	IF MYFILE(m.FILENAME)
		DECLARE INTEGER ShellExecute IN SHELL32.DLL ;
			INTEGER handle,;
			STRING @sFile,;
			STRING @lp,;
			STRING @DIR,;
			STRING @dir1,;
			INTEGER ncmd
		LNRETVAL = SHELLEXECUTE(0, LCOPERATION, m.FILENAME, "", "", 1)
	ELSE
		MESSAGEBOX("Unable to locate the File : "+m.FILENAME,48,"Problem")
	ENDIF
	RETURN(.F.)

FUNCTION MYFILE
	PARAMETER m.FILENAME,m.RETNAME,m.RETSIZE
	PRIVATE m.FILENAME,m.RETNAME,m.RETVAL
	IF PCOUNT() < 3
		m.RETSIZE = .F.
	ENDIF
	IF PCOUNT() < 2
		m.RETNAME = .F.
	ENDIF
	IF m.RETSIZE
		m.RETVAL = 0
	ELSE
		IF m.RETNAME
			m.RETVAL = ""
		ELSE
			m.RETVAL = .F.
		ENDIF
	ENDIF
	ON ERROR DO FILEERR
	IF !EMPTY(m.FILENAME)
		IF ADIR(TMPDIRFILES,m.FILENAME) > 0
			IF m.RETSIZE
				m.RETVAL = TMPDIRFILES(1,2)
			ELSE
				IF m.RETNAME
					m.RETVAL = TMPDIRFILES(1,1)
				ELSE
					m.RETVAL= .T.
				ENDIF
			ENDIF
		ENDIF
		RELEASE TMPDIRFILES
	ENDIF
	RETURN(m.RETVAL) 

Regards

Griff
Keep Smileing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are !good for you.

There is no place like G28 X0 Y0 Z0

RE: How to display an excel report in foxpro?

Hi Niki,

Quote:


I want to create a excel report

Do you want to create an Excel-sheet and copy the data from a VFP table to it? If that's the case please have a look at the following commands APPEND FROM, COPY TO, Import, Export.

hth

MarK

RE: How to display an excel report in foxpro?

I would echo what Mark says. In my reply, I was assuming that you already have a FoxPro report, and that you want to convert it to Excel. But if that is not the case, please explain your requirement in a bit more detail.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: How to display an excel report in foxpro?

I second Mike with FoxyPreviewer, already pointed that out, it would be integrated on the level of the preview of a VFP report, so you'd not need the radio buttons on your form anymore. It's also less intrusive than a question, as it's just part of a toolbar during print preview to either print or export as file, also PDF or XLS.

Aside of that, the simplest option surely is COPY TO with TYPE XLS or XL5 or EXPORT.

And a third option is using Vilhelm-Ion Praisachs export libraries. You find lots of options on http://praisachion.blogspot.com/search?q=export

Chriss

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close