文章来源:互联网
*********************************************************
* vfp9终结一直以来关于打印纸张设置
* 过程名称:MyReport.prg
* 调用方式:MyReport(ReportName, Height, Width)
* 当 Height和Width为空时,默认A4纸
* 程序原创:dupeiji
* 最后修改:pnyjq
* 修改日期:2005-03-23
* 待解决问题:当ListenerType = 1时无法正常预览
*********************************************************
Parameters lcFRX, nHeight, nWidth
Local loReportListener
If Empty(lcFRX)
Return
Endif
loReportListener = Createobject("Test")
#DEFINE A4_Height 29.7
#DEFINE A4_Width 21
loReportListener.sHeight=Icase(Empty(nHeight), A4_Height, nHeight)
loReportListener.sWidth=Icase(Empty(nWidth), A4_Width, nWidth)
Report Form (lcFRX) Object loReportListener
Define Class Test As ReportListener
ListenerType = 0
sHeight=0
Procedure GetPageHeight()
If This.sHeight >0
Return This.sHeight * 377.95
Else
Return DoDefault()
Endif
Endproc
sWidth=0
Procedure GetPageWidth()
If This.sWidth >0
Return This.sWidth * 377.95
Else
Return DoDefault()
Endif
Endproc
Procedure OutputPage(nPageNo, eDevice, nDeviceType, nleft, nTop, nWidth, nHeight)
t_sHeight=This.sHeight
This.sHeight=0
nHeight=t_sHeight * 377.95 * nHeight/This.GetPageHeight()
This.sHeight=t_sHeight
t_sWidth=This.sWidth
This.sWidth=0
nWidth=t_sWidth * 377.95 * nWidth/This.GetPageWidth()
This.sWidth=t_sWidth
DoDefault(nPageNo, eDevice, nDeviceType,nleft, nTop, nWidth, nHeight)
Nodefault
Endproc
Enddefine
联系客服