Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Output a report in PDF format
Message
From
13/04/2010 05:48:27
 
 
To
13/04/2010 05:18:26
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01455338
Message ID:
01459895
Views:
98
Hi Irene
See my answers inline;

>I've restored the main alias and also the pointer just after the report was called the first time (preview). This works. I would appreciate it if you can look at he code still, just to make sure I am doing it correct. I'm also interested how your RS preview works. I would prefer doing it the correct way.
>
>Here is my code:
>
>*!* Initialize event
>
>LOCAL  cRSServerFolder, cGdiPlusX
>cRSServerFolder = 'n:\bkb\RsDev'
>DO (ADDBS(cRSServerFolder) +'ReportSculptor.App')
>
>cGdiPlusX=addbs(_oRSGO.RS_Root) + 'GdiPlusX\system.app'   &&System_lean renamed to system
>do (cGdiPlusX)
>set classlib to "C:\Program Files\Microsoft Visual FoxPro 9\Ffc\_ReportListener.VCX"  additive

&&This is correct, however you can do it only ONCE at the begin of your main module. 
&&Later in your code you are repeating this sequence without being necessary.


>
>
>
>*!* Print command button
>
>IF ISBLANK(thisform.txtDeclREF.value) then
>	WAIT WINDOW 'You have TO enter a REFERENCE TO be used on printout!' timeout 2
>	thisform.txtDeclREF.SetFocus
>	RETURN
>ELSE
>	lcRef = thisform.txtDeclREF.value
>ENDIF
>
>SELECT lotcurs
>
>COUNT TO lnRecCnt
>IF lnRecCnt > 0 then
>	REPORT FORM declletter TO PRINTER PROMPT preview
>	thisform.cmdEmail.Enabled = .T.
>	SELECT lotcurs   && code added to get rid of PDF error 13/10/2010
>	GOTO top              && code added to get rid of PDF error 13/10/2010
>	IF thisform.chkEmailVet.Value = 1 then
>		lnAnswer = MESSAGEBOX('Are you sure you want to email the State VET?',4+32+256,'Email confirmation')
>		IF lnAnswer = 6 then
>			WAIT WINDOW 'Preparing email...' TIMEOUT 3
>
>			LOCAL  cRSServerFolder, cGdiPlusX
>                                                                 *!* For every run the filename differs

                        &&You can remove this part if you are doing it at the begin of your app.
>			cRSServerFolder = 'n:\bkb\RsDev'
>			DO (ADDBS(cRSServerFolder) +'ReportSculptor.App')
>
>			cGdiPlusX=addbs(_oRSGO.RS_Root) + 'GdiPlusX\system.app'   &&System_lean renamed to system
>			do (cGdiPlusX)
>>			set classlib to addbs(home()) + "FFC\" + "_ReportListener.VCX"  additive
>
                       && Up to here

			gcBuyer = thisform.cbuyer

>
>			IF ISBLANK(thisform.txtDeclREF.value) then
>				WAIT WINDOW 'You have TO enter a REFERENCE TO be used on printout!' timeout 2
>				thisform.txtDeclREF.SetFocus
>				RETURN
>			ELSE
>				lcRef = thisform.txtDeclREF.value
>			ENDIF

&& If you are using form value reference directly inside FRX, then you might run into trouble
&& because when invoked via function RS conversion does not know about your running form.
&& this can be solved easily by placing value in a public or private variable and then use this 
&& inside FRX

                        private  gcRef
                        gcRef =  thisform.txtDeclREF.value

&&also try to supply full path to FRX, it should work like this but try also 
&& with full or relative path like;  cFrx= '.\reports\declletter.frx'   
>			cFrx= 'declletter.frx'   
			=frx2rs(cFrx, 5 , .F.)			&& .T. = Preview

                        && this function returns directly pdf file created
                        && so you can use something like;
                        lcfrom= frx2rs(cFrx, 5 , .F.)			&& .T. = Preview
                        
>
>			thisform.sendemail()
>			
>			*!* Copy and clear files
**			lcfrom = 'w:\send\' + ALLTRIM(gcExpFile) + '.pdf'
>			lcTo = 'w:\send\Talman reports\RVF\Emails send\' + ALLTRIM(gcExpFile) + '.pdf'
>			COPY FILE (lcfrom) TO (lcTo)
>			DELETE FILE (lcFrom)
>		ELSE
>			WAIT WINDOW 'Email cancelled on users request!' TIMEOUT 2
>		ENDIF
>	ENDIF
>ELSE
>	WAIT WINDOW 'You have to list the records before printing them!' TIMEOUT 2
>ENDIF
>
>
>
>
>*!* RS program
>
>

>*** Note ***
>
>*** Do NOT Compile this prg
>*** This prg is just to set you up for trying samples in this Demo Project
>*** After running this, you should be able to run all stuff inside this project.
>*** To verify succesfull dev setup - run helloworld test script
>
>***See readme.txt for run time deployment instructions
>
>*!* clear all
>
>*!* ********************RS / GDI+X Inititalision sequence **********
>*!* local cRootFolder,cGdiPlusX
>*!* cRootFolder = justpath(justpath(sys(16,1)) )
>*!* do addbs(cRootFolder) + 'ReportSculptor.App'
>
>*!* ** Initialise GdiPlusX supplied in subfolder of this project
>*!* ** (Required version 1.20 with EMF support!)
>*!* cGdiPlusX=addbs(_oRSGO.RS_Root) + 'GdiPlusX\system.app' &&System_lean renamed to system
>*!* do (cGdiPlusX)
>
>*!* set classlib to addbs(home()) + "FFC\" + "_ReportListener.VCX" additive &&Remove if you already did it elsewhere
>*!* *******************************************************************
>
>
>*!* set default to (cRootFolder)
>*!* set procedure to sys(16,1) additive
>*!* set path to ;data;FreeTables;forms;GRAPHICS;LIBS;PROGS;REPORTS additive
>
>*** Important !!!
>
>*** As indicated in Redme.txt, for compiling purposes
>*** ALL CODE BELOW THIS POINT has to be appended (copied) to some of YOUR run time
>*** visible code libraries.( Along with other general purpose functions you use)
>*** See developer's guide for more info on integration.
>
>*** Do NOT include and compile this prg into your development environment
>*** Code below is used by this demo project as setup routine when you are going through samples
>*** once you integrate RS, you should use your own develpment environment
>*** for developing RS based reports. This project is just for demo purposes.
>
>
>************************************
>function rsGlobalObjectSetup
> lcExt = TTOC(DATETIME(),1)
>
> gcExpFile = ALLTRIM(gcBuyer) + 'RVFdecl' + ALLTRIM(lcExt)
> with _oRSGO
>
> **Global properties applied at RS Engine instantiation
> .xfrx_active = 'Y' &&Change to 'Y' if you are using XFRX
> .xfrx_path = '\XFRX127' &&Set your own XFRX run time path
>
>
> .rs_EngineClass = 'MyRS' && RS Engine Subclass used to customise RS Engine
> &&(Just below this function)
>
> .LanguagesEnabled=.f. && To use or create localisation set to .t.
> .myLanguage = 'English' && Set to your own language (if translation exist)
> && See Localise_Strings.prg for creating new language table/translation
>
> .rsExportFolder = 'W:\send'
> .rsExportStem=(gcExpFile) &&Name of export file without extension
>
>
> endwith

This is all for now, Will reply further here in a few hours. Hv to run now.
Pls try one of above, then we continue later.

HTH
Sergio
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform