Partilhar via


GetPageHeight Method

Returns page height in 960 dots per inch (dpi) during a report run.

iPageHeight = oReportListener.GetPageHeight()

Parameters

None.

Return Value

Integer data type, the height of the page in 1/960ths of an inch. Between report runs, this method returns 0.

Remarks

Applies To: ReportListener Object.

This method and GetPageWidth allow a preview object or any other “participant” in the output process to interrogate the ReportListener object for the dimensions of page output, as determined by the printer settings in force for the report run. The ReportListener's PreviewContainer uses these methods when the ReportListener object calls its Show method, to determine how to display the current report's contents.

These methods provide usable values at all points in the reporting process after BeforeReport and before UnloadReport, unless you invoke continuation by using NOPAGEEJECT on your REPORT FORM command. If you use NOPAGEJECT, these methods continue to provide usable results until a REPORT FORM without NOPAGEEJECT arrives at its UnloadReport event. At other times, both methods return 0.

Note

The time period during which GetPageHeight and GetPageWidth provide usable values is determined by when the ReportListener sets up the page layout and print job. The ReportListener does not re-evaluate page layout and page dimensions between REPORT FORM commands when you use NOPAGEJECT since these report runs are part of a single print job. However, you can create classes derived from ReportListener that can handle multiple page sizes during a continued report run.

For more information about the sequence of events at the beginning and end of a report run, see Understanding Visual FoxPro Object-Assisted Reporting.

Example

You can override this method to provide custom page size information.

Important

Providing different information to the ReportListener's rendering mechanism will not send page size instructions to your printer. When a printer receives the information for each page, and when the information it receives does not match its anticipated page format, it has latitude to determine how it will handle the output data. For example, it can stretch the output data for a short page until it fits the expected paper size. However, overriding this method with different instructions can provide significant functionality to other forms of output not dependent on fixed physical page sizes, such as HTML.

In the following example, an object derived from the ReportListener class overrides GetPageHeight according to the value of a custom property. The example shows a preview of two report runs with different page heights, and uses the ReportListener DoMessage method and OutputPageCount property, to show you that the two report runs for the same report have different numbers of pages.

LOCAL loReportListener, lcFRX

lcFRX = GETFILE("frx")
IF EMPTY(lcFRX)
   RETURN 
ENDIF   

loReportListener = CREATEOBJECT("halfSizePage")

REPORT FORM (lcFRX) OBJECT loReportListener
loReportListener.DoMessage("This report run was: " + ;
    TRANSF(loReportListener.OutputPageCount) + " pages long.")

loReportListener.wantHalfSizePage = .T.
    
REPORT FORM (lcFRX) OBJECT loReportListener
loReportListener.DoMessage("This report run was: " + ;
    TRANSF(loReportListener.OutputPageCount) + " pages long.")


DEFINE CLASS halfSizePage As ReportListener
   ListenerType = 1
   AllowModalMessages = .T.
   wantHalfSizePage = .F.
   
   PROCEDURE GetPageHeight()
     LOCAL liSize
     liSize = DODEFAULT()
   RETURN IIF(THIS.wantHalfSizePage, liSize/2, liSize)
ENDDEFINE

See Also

Reference

ReportListener Object
GetPageWidth Method
PreviewContainer Property
The Preview Container API

Other Resources

Methods (Visual FoxPro)
Language Reference (Visual FoxPro)