Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Want Summary Band at bottom of page.
Message
From
22/01/2009 13:11:43
 
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Vista
Network:
Windows 2008 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01345297
Message ID:
01376364
Views:
30
Yes, I did. In fact, I got a PERFECT solution from Christof Wallenhaupt, See his reply to me in this same thread. It was message#1345657. It solved the problem exactly.

I'm posting my code below so you can see what I did. Let me know if you need help trying to implement it. It was really very easy.

To re-state the problem: How can you move the Report Summary Band to be flush with the bottom of the last page, rather than the default behavior, which is that it comes immediately after the last record on the report, which could make it appear in the middle of the page. I wanted it always flush with the bottom of the page.

This solution involves the Report Listener object in VFP....

So, you need to do 4 (easy) things to make it work.

1. Set system variables _REPORTOUTPUT, _REPORTPREVIEW, and _REPORTBUILDER (see code below)
2. Define a listener class to move the Summary Band (see below Define Class code)
3. Create an object instance based on that class (see code below)
4. Finally, run the report, and specify the report listener object to use (see code below)

(Also, you'll need to set the property nSummaryHeight in the class or object instance to be the correct size to match the height of your summary band.) I put it in my class becuase mine are all the same. You can adjust it at the object instance level too, after the object is created.

Here is my code that I implemented after reading (and copy-pasted) his message, with a few edits.

(the first two items need to be in your startup.prg file)
   *-- 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 90
and (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                        

EndDefine
and 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 oReportSummaryMover
Depending 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.

Good luck.



>Matt,
>
>I know this was ages ago but did actually manage to get a 'civilized' or 'reasonable' solution to this problem?
>
>Regards
>
>
>>On my reports, how can I make the Summary Band flush with the BOTTOM of the last page of the report? It will mean having an unknown amount of white space from the last detail record. The last page may have only 2 or 3 detail records, or it may fill 75% of the page. Either way, I still want the Summary Band all the way at the bottom of the page. The Summary Band spans about 1" of vertical space on the report.
>>
>>I have tried putting it in a Page Footer, and setting the "Print When" of each element to make it print only on the last page, but when you do it hat way, the space is allocated at the bottom of every page, and I don't like that. (If haven't tried this method since upgrading to VFP9, so maybe that behavior is different now, but I doubt it.)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform