我正在尝试使用Crystal报表(在VB应用程序中运行的Crystal XI)在尝试直接打印报表时收到零星“缺少参数值”错误的问题。这里的问题的总结:Crystal Reports XI PrintToPrinter“缺少参数值”
- 用户运行通过报告菜单报告(一切正常)
- 用户点击“打印预览”(一切正常)
- 用户点击“打印”(假设将文档直接发送到打印机,但有时会缺少参数错误)
以下是我对代码开始:
crystalReportViewer.MdiParent = parent
crystalReportViewer.Show()
Dim report As ReportDocument = CType(crystalReportViewer.ReportSource, ReportDocument)
report.PrintToPrinter(1, False, 0, 0)
crystalReportViewer.Close()
crystalReportViewer.Dispose()
基于什么我已经google搜索,我想出了这个代码:
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()
我对了对如何解决这个问题的想法。有没有其他人跑过这个?
你能分享你得到的例外吗? – Asif 2012-07-06 05:00:55
下面是错误的截图:http://tinypic.com/r/6tl84z/6 – lmg 2012-07-06 13:18:35