VB6 加载水晶报表例子

VB6 加载水晶报表例子

先按照水晶报表组件 Crystal Reports,Business Objects,现已被SAP收购。

再添加引用

'Library: CRAXDRT

'C:\Program Files\Business Objects\Common\3.5\bin\craxdrt.dll

'Crystal Reports ActiveX Designer Run Time Library 11.5

Dim Report As CRAXDRT.Report

Dim crApplication As New CRAXDRT.Application

Private Sub Form_Load()

Dim sFile As String

sFile = App.Path & "\Reports\test.rpt"

Set Report = crApplication.OpenReport(sFile)

Screen.MousePointer = vbHourglass

CRViewer1.ReportSource = Report

CRViewer1.ViewReport

Screen.MousePointer = vbDefault

End Sub

Private Sub Form_Resize()

CRViewer1.Top = 0

CRViewer1.Left = 0

CRViewer1.Height = ScaleHeight

CRViewer1.Width = ScaleWidth

End Sub