参考示例:
报表文件
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
图片附件: 游客没有浏览图片的权限,请
登录 或
注册
程序代码:
_screen.Visible = .F.
CREATE CURSOR tt (ss C(10), ff I)
FOR i = 1 TO 200
INSERT INTO tt VALUES (PADL(i, 10, "0"), i)
ENDFOR
oRP = CREATEOBJECT("myRetroPreview")
* C:\PROGRAM FILES (X86)\MICROSOFT VISUAL FOXPRO 9\REPORTPREVIEW.APP
* 将 REPORTPREVIEW.APP 复制到当前文件夹
oPC = NULL
DO ReportPreview.app WITH oPC
oPC.SetExtensionHandler(oRP)
oRL = CREATEOBJECT("Reportlistener")
oRL.ListenerType = 1
oRL.OutputType = 1
oRL.DynamicLineHeight = .F.
oRL.PreviewContainer = oPC
oRPF = CREATEOBJECT("myReportPreviewForm")
myReportFileName = "报表1.frx"
REPORT FORM (myReportFileName) PREVIEW IN WINDOW (oRPF.Name) OBJECT oRL
CLEAR ALL
RETURN
DEFINE CLASS myReportPreviewForm as Form
Desktop = .T.
ShowWindow = 2
WindowState = 2
TitleBar = 0
ENDDEFINE
DEFINE CLASS myRetroPreview AS Custom
PROCEDURE Show(iStyle)
this.PreviewForm.Caption = ""
this.PreviewForm.BorderStyle = 1
this.PreviewForm.TitleBar = 0
this.PreviewForm.WindowState = 2
this.PreviewForm.Toolbar.Dock(0)
BINDEVENT(this.PreviewForm.Toolbar.CmdPrint, "Click", this, "myPrintClick")
ENDPROC
PROCEDURE AddBarsToMenu(cPopup, iNextBar)
FOR i = 1 TO CNTBAR(cPopup)-1
RELEASE BAR i OF (cPopup)
ENDFOR
ENDPROC
PROCEDURE Release
IF MESSAGEBOX("要关闭吗?",4+32+256)==6
RETURN .T.
ENDIF
RETURN .F.
ENDPROC
PROCEDURE myPrintClick
MESSAGEBOX("点击了打印按钮")
ENDPROC
ENDDEFINE