Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Blum
  Where is Ken Blum?
 Chicago
 Illinois - United States
 Ken Blum
 Tags
Subject: Reportlistener with multiple Page Sizes
Thread ID: 188985 Message ID: 188985 # Views: 3 # Ratings: 0
Version: Visual FoxPro 9 Category: Reports and Printers
Date: Tuesday, August 12, 2008 9:34:18 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

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