Author: Richard Kaye
Posted: 2006-03-24 at 07:51:04
I'm using it to generate PDFs and Word documents and have been very
pleased with the results. However I made a conscious decision to only
support it in VFP 8 or later. It was a good excuse to get my clients to
upgrade the version of VFP they were running. You can turn on logging by
calling the InitLog method of your XFRX object. It might offer some
insight. (Also, you are generating an HTML file in your example, not a
PDF.) I've also found that Martin
This is the class I created for testing purposes when I was evaluating
XFRX for use in my main app. I also tested two other products at the
time but I've stripped out the stuff that tested them and tried to make
it a little less specific to my environment. You pass it 3 params; an
object reference to the calling form, the report you want to run (which
I store as a property of my base form class), and the alias that holds
the main cursor for the report. I did not implement the report scope, as
you are in your example, but maybe this will be helpful in
troubleshooting your problem.
*!* Program: RETEsting.prg
*!* Author: Richard Kaye
*!* Date: 10/20/04 10:11:32 AM
*!* Copyright: RFC Systems 2004
*!* Description: Class to facilitate testing report engines
*!* Call like this:
*!* SET PROCEDURE TO RETesting ADDITIVE
*!* LOCAL loRETest
*!* loRETest=NEWOBJECT([RETesting])
*!* loRETest.RETest(this.Parent,thisform.ReportForm, ALIAS())
*!* loRETest=NULL
*!* RELEASE PROCEDURE retesting
*!* RELEASE loRETest
DEFINE CLASS RETesting AS Custom
PROCEDURE RETest
LPARAMETERS toForm, tcReportForm, tcAlias
ASSERT VARTYPE(toForm)=[O] MESSAGE [Must pass object reference to parent
form!]
ASSERT VARTYPE(tcAlias)=[C] AND NOT EMPTY(tcAlias) MESSAGE [Must pass
current alias!]
LOCAL lcReportForm, s
s=SELECT()
IF VARTYPE(tcReportForm)=[L] OR (VARTYPE(tcReportForm)=[C] AND
EMPTY(tcReportForm))
IF NOT EMPTY(toForm.ReportForm)
lcReportForm=toForm.ReportForm
ELSE
RETURN .f.
ENDIF
ELSE
IF EMPTY(tcReportForm)
lcReportForm=toForm.ReportForm
ELSE
lcReportForm=tcReportForm
ENDIF
ENDIF
IF VERSION(2)>0 && debug mode
SELECT (tcAlias)
#IF VERSION(5)>=800
IF MESSAGEBOX([Test XFRX?],4+32,[Report Engine Testing])=6
LOCAL loSession, loProgress, lnRetval
*!* - rk - 2004-11-30 - macroize to avoid build errors
cCmd=[loSession=xfrx("XFRX#Init")]
&cCmd
*!* loSession=xfrx("XFRX#Init")
loProgress = NEWOBJECT("progress",[progress.prg])
loSession.InitLog()
lnRetVal = loSession.SetParams(lcReportForm,,,,,,"PDF")
IF lnRetVal = 0
loSession.setProgressObj(loProgress,2)
loSession.setThisform(toForm)
*!* loSession.setThis(THIS)
loSession.ProcessReport(lcReportForm,,,)
loSession.finalize
ENDIF
ELSE
MODIFY REPORT (lcReportForm)
ENDIF
#ENDIF
ENDIF && m.debug
SELECT (s)
ENDPROC && RETest
ENDDEFINE
Paul Czura wrote:
> Now when I attempt to copy the source code to create a PDF from the demo
> into a blank PRG file to run the exact same code, I never seem to
> progress far.
>
> I have a report which has the tables in a private data session within
> the report, these tables are all related via relationships.
>
> Below is the quote I am attempting to run in this stand alone prg file.
>
> When I run the program I only get a wait window "Progress" and it seems
> that the program has hung, but as I said when I run it through the demo
> it works fine.
>
> Any suggestions? Would be greatly appreciated.
>
>
> close all
> loSession=xfrx("XFRX#Init")
> SET PATH TO c:\a_m
> SELECT 0
> USE quote.DBF order quote_no IN 0
> SELECT quote
> GO TOP
> loProgress = createobject("progress")
> lnRetVal = loSession.SetParams("QUOTE",,,,,,"HTML")
>
> If lnRetVal = 0
> loSession.setProgressObj(loProgress,2)
> loSession.ProcessReport("RPTQUOTE.FRX","quote_no = '48450 '",,)
> loSession.finalize()
> EndIf
>
--
Richard Kaye
RFC Systems
Voice: 973.761.0868
Fax: 973.761.4329
For the fastest response time, please send your tech support
queries to techsupport@rfcsystems.com
---------------------------------------------------------
---------------------------------------------------------