Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Cathy Pountney
  Where is Cathy Pountney?
 Jenison
 Michigan - United States
 Cathy Pountney
 To: Ken Blum
  Where is Ken Blum?
 Chicago
 Illinois - United States
 Ken Blum
 Tags
Subject: RE: Reportlistener with multiple Page Sizes
Thread ID: 188985 Message ID: 189147 # Views: 3 # Ratings: 0
Version: Visual FoxPro 9 Category: Reports and Printers
Date: Wednesday, August 13, 2008 2:27:59 PM         
   


> I'm using the AddReport and RunReports methods of the ReportListener class to chain multiple reports together into a single report preview. Some of the FRX reports are landscape and others are portrait. When running the reports it always uses the page size of the first report. How can I tell it to reload the page size on every report? I know it has something to do with GetPageWidth and GetPageHeight, but how can I tell which report it is calling these methods for?
>
> Here is the code I use that contains a custom method to change to the appropriate cursor before rendering the report...
>
>
LOCAL loListener,nLastReport,i
> 
> SET REPORTBEHAVIOR 90
> 
> loListener = NEWOBJECT("_ReportListener","KTB_Reportlistener.vcx")
> loListener.ListenerType = 1
> LOCAL cLastRepParm
> cLastRepParm = 'TO PRINTER PROMPT PREVIEW WINDOW PrintPrev'
> * Need to know which report is the last report...
> FOR nLastReport = 6 TO 1 STEP -1
> 	IF THISFORM.Additional_reports_run[nLastReport]
> 		EXIT
> 	ENDIF
> ENDFOR
> 
> * Add generated reports to the listener with related cursor and report file.
> IF nLastReport = 0
> 	loListener.AddReport('SeRRep.frx',cLastRepParm ,,"SERREP_DATA")
> ELSE
> 	loListener.AddReport('SeRRep.frx','NOPAGEEJECT',,"SERREP_DATA")
> 	FOR i = 1 TO 6
> 		IF THISFORM.Additional_Reports_Run[i]
> 			IF i = 1 OR i = 3 OR i = 5
> 				loListener.AddReport('DBLoadEff.Frx',IIF(i = nLastReport,cLastRepParm ,'NOPAGEEJECT'),,"DBLEREP"+ALLTRIM(STR(i+10)))
> 			ENDIF
> 			IF i = 2 OR i = 4
> 				loListener.AddReport('DBOpEff.Frx',IIF(i = nLastReport,cLastRepParm ,'NOPAGEEJECT'),,"DBOEREP"+ALLTRIM(STR(i+10)))
> 			ENDIF
> 			IF i = 6
> 				loListener.AddReport('Inv_Ad.Frx',IIF(i = nLastReport,cLastRepParm ,'NOPAGEEJECT'),,"REP_DATA")
> 			ENDIF		
> 		ENDIF
> 	ENDFOR
> ENDIF
> 
> * Create the Print Preview window...
> IF VARTYPE(oPrintPrev) != 'O'
> 	PUBLIC oPrintPrev
> 	oPrintPrev = NEWOBJECT("Print_Preview","dbrepgraphs.vcx")
> 	WITH oPrintPrev
> 		.Name = "PrintPrev"
> 		.Caption = TTOC(SrHeader.Start_Date)+" Service Report Preview"
> 	ENDWITH
> ENDIF
> 
> * Run the reports, which will convert DBOEREP## AND DBLEREP## Cursors and public Vars via the Setup_Report_Data method...
> loListener.RunReports()
> 
> 

>
> KTB

The native behavior of chained reports is to use the orientation from the first report on all subsequent reports. Lisa Slater Nicholls wrote an article for FoxTalk way back in Oct 2005 that showed how to get around this. If you have access to FoxTalk archives, check that .. or check Lisa's website to see if she has it posted there.

Cathy Pountney
www.cathypountney.blogspot.com

ENTIRE THREAD

Reportlistener with multiple Page Sizes Posted by Ken Blum @ 8/12/2008 9:34:18 PM
RE: Reportlistener with multiple Page Sizes Posted by Cathy Pountney @ 8/13/2008 2:27:59 PM