1,217
社区成员




Option Explicit
Private crApp As New CRAXDRT.Application
Private crReport As New CRAXDRT.Report
Private Sub Form_Load()
Set crReport = crApp.OpenReport(App.Path & "\a.rpt", 1)
' 注意参数的顺序(是按照你新建的顺序的,与显示顺序可能不一致),如果你拿不准,弹出来看看
'
'MsgBox crReport.FormulaFields(1).Name
'MsgBox crReport.FormulaFields(2).Name
'MsgBox crReport.FormulaFields(3).Name
'MsgBox crReport.FormulaFields(4).Name
'MsgBox crReport.FormulaFields(5).Name
' 动态指定两个轴的字段
crReport.FormulaFields(1).Text = "{product.Product Class}"
crReport.FormulaFields(2).Text = "{product.Product ID}"
'设置轴描述,题头
crReport.FormulaFields(3).Text = """我的横轴啊横轴"""
crReport.FormulaFields(4).Text = """我的纵轴啊纵轴"""
crReport.FormulaFields(5).Text = """标题啊标题"""
CrystalActiveXReportViewer1.ReportSource = crReport
CrystalActiveXReportViewer1.ViewReport
End Sub