this.oCR = createobject("CrystalRuntime.Application") oReport = this.oCR.OpenReport(this.cReportName) oPreview = createobject(this.cpreviewform) && VFPForm with oPreview .oCR = this.oCR .oCRReport = oReport .PreviewReport(this.cReportName) this.SetPreviewWindow(loPreview) .show() && Crash endwith procedure setpreviewwindow(oPreview) if vartype(oPreview) == [O] if !empty(this.previewheight) oPreview.height = this.previewheight endif if !empty(this.previewwidth) oPreview.width = this.previewwidth endif if !empty(this.previewtop) oPreview.top = this.previewtop endif if !empty(this.previewleft) oPreview.left = this.previewleft endif if vartype(oPreview.oleCRViewer) == [O] with oPreview.oleCRViewer .DisplayBackgroundEdge = this.displaybackgroundedge && .T. .DisplayBorder = this.displayborder && .T. .DisplayGroupTree = this.displaygrouptree && .F. .DisplayTabs = this.displaytabs && .T. .DisplayToolbar = this.displaytoolbar && .T. .EnableCloseButton = this.enableclosebutton && .T. .EnableDrillDown = this.enabledrilldown && .F. .EnableExportButton = this.enableexportbutton && .T. .EnableGroupTree = this.enablegrouptree && .F. .EnableHelpButton = this.enablehelpbutton && .F. .EnableNavigationControls = this.enablenavigationcontrols && .T. .EnablePopupMenu = this.enablepopupmenu && .F. .EnablePrintButton = this.enableprintbutton && .T. .EnableProgressControl = this.enableprogresscontrol && .T. .EnableRefreshButton = this.enablerefreshbutton && .T. .EnableSelectExpertButton = this.enableselectexpertbutton &&.T. .EnableSearchControl = this.enablesearchcontrol && .T. .EnableSearchExpertButton = this.enablesearchexpertbutton && .T. .EnableStopButton = this.enablestopbutton && .F. .EnableToolbar = this.enabletoolbar && .T. .EnableZoomControl = this.enablezoomcontrol && .T. endwith endif endif endproc oPreview :: PreviewReport lparameters tcReport if vartype(tcReport) = "C" if vartype(this.oCRApp) <> "O" this.oCRApp = createobject("CrystalRuntime.Application") endif if vartype(this.oCRReport) <> "O" if file(tcReport) this.oCRReport = this.oCRApp.OpenReport(tcReport) endif endif endif if vartype(this.oCRApp) = "O" and vartype(this.oCRReport) = "O" if type("ThisForm.oleCRViewer") = "O" thisform.removeobject("oleCRViewer") endif thisform.addobject("oleCRViewer", "olecontrol", "CRViewer9.CRViewer.9.2") with thisform.oleCRViewer .width = thisform.width .height = thisform.height .visible = .t. doevents loReport = this.oCRReport .ReportSource = loReport .EnableExportButton = .t. doevents .ViewReport() endwith endif