*-- 2008-05-27: Addded this VFP 9 ReportBehavior stuff ---- && Report output _REPORTOUTPUT = FULLPATH("REPORTOUTPUT.APP") && Report preview _REPORTPREVIEW = FULLPATH("REPORTPREVIEW.APP") && Report Writer _REPORTBUILDER = FULLPATH("REPORTBUILDER.APP") Set Reportbehavior 90and (to define the class):
*------------------------------------------------------------------------------------------------------ *-- Report Listener Class to move Report Summary to bottom of the last page. *-- Solution provided by Christof Wollenhaupt on Universal Thread 09/08/2008. *-- Message ID: 1345657 *------------------------------------------------------------------------------------------------------ Define Class ReportSummaryMover as ReportListener lInSummary = .F. nSummaryHeight = 1100 && 960th inch nSummaryStart = NULL Procedure BeforeBand( nBandObjCode, nFRXRecNo ) This.lInSummary = nBandObjCode = 8 This.nSummaryStart = NULL EndProc Procedure AfterBand( nBandObjCode, nFRXRecNo ) This.lInSummary = .F. EndProc Procedure render(nFRXRecNo,nLeft,nTop,nWidth,nHeight,; nObjectContinuationType, cContentsToBeRendered, GDIPlusImage) Local lnNewTop If This.lInSummary If IsNull(This.nSummaryStart) This.nSummaryStart = m.nTop EndIf lnNewTop = m.nTop - This.nSummaryStart + ; This.GetPageHeight() - This.nSummaryHeight DoDefault( nFRXRecNo, nLeft, m.lnNewTop, nWidth,nHeight,; nObjectContinuationType, cContentsToBeRendered, GDIPlusImage ; ) NoDefault EndIf EndProc EndDefineand finally, create the listener object, then run a report with it (notice OBJECT keyword on REPORT line) :
*-- Create a report listener object to move the report footer to the very bottom of the page oReportSummaryMover = CreateObject('ReportSummaryMover') oReportSummaryMover.ListenerType=Iif(((lcPrintMode='PREVIEW') or thisform.external_call), 1, 0) *--(for above, 1=Preview, 0=Print )--- lcPreview=iif((lcPrintMode='PREVIEW') or thisform.external_call, 'Preview ', '') lcPrinterPrompt=Iif(thisform.ChoosePrinter.value=1, 'Prompt ', '') REPORT form (thisform.ReportName) to printer &lcPrinterPrompt &lcPreview Noconsole OBJECT oReportSummaryMoverDepending on your program deisgn, you may (or may not) want to release the object after using it. Once it exists, it can be used on any other report you want to run.