【发布时间】:2012-07-05 21:13:57
【问题描述】:
我正在处理 Crystal 报表(在 VB 应用程序中运行的 Crystal XI)的问题,在尝试直接打印报表时收到零星的“缺少参数值”错误。以下是问题的摘要:
- 用户通过报告菜单运行报告(一切正常)
- 用户点击“打印预览”(一切正常)
- 用户点击“打印”(本应将文档直接发送到打印机,但有时会出现缺少参数错误)
这是我要开始的代码:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
根据我一直在谷歌搜索的内容,我想出了以下代码:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
'here are my attempts to get it to work
Dim pf As ParameterFields = report.ParameterFields
report.PrintOptions.PrinterName = "Microsoft XPS Document Writer"
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
我对如何解决这个问题一无所知。有没有其他人遇到过这个?
【问题讨论】:
-
你能分享一下你得到的异常吗?
-
这里是错误截图:tinypic.com/r/6tl84z/6
标签: printing parameters crystal-reports reporting