Occurs when the user closes a report preview or opts to print from a report preview.
|
|---|
oReportListener.OnPreviewClose([lPrint]) |
Parameters
-
lPrint
-
Specifies whether the user indicated a desire to print the pages in the current output page set after closing the report preview.
Return Value
Remarks
Example
You can alter the various dynamic members of CommandClauses during the OnPreviewClose method, to print complex page ranges. In the following code sketch, a derived ReportListener provides a custom dialog to gather a complex page range from a user, and then invokes the native behavior multiple times to print the various page ranges requested by the user.
| | Copy Code |
|---|
PROCEDURE OnPreviewClose(lPrint)
LOCAL liRange
IF lPrint
NODEFAULT
IF NOT EMPTY(THIS.CommandClauses.PrintPageCurrent
*user chose "print current page" option from PreviewContainer.
*Print only that page:
THIS.CommandClauses.PrintRangeFrom = ;
THIS.CommandClauses.PrintPageCurrent
THIS.CommandClauses.PrintRangeTo = ;
THIS.CommandClauses.PrintPageCurrent
DODEFAULT(.T.)
ELSE
THIS.ShowCustomPageSetupDialog()
THIS.CommandClauses.Prompt = .F.
IF EMPTY(THIS.PageRangeArray[1])
* no printing is requested
DODEFAULT(.F.)
ELSE
* user chose at least one range;
* go through the array set up by
* the dialog and print the range(s)
FOR liRange = 1 TO (ALEN(THIS.PageRangeArray,1))
THIS.CommandClauses.PrintRangeFrom = ;
THIS.PageRangeArray[liRange,1]
THIS.CommandClauses.PrintRangeTo = ;
THIS.PageRangeArray[liRange,2]
DODEFAULT(.T.)
ENDFOR
ENDIF
ENDIF
ENDIF
ENDPROC |
See Also