我正在嘗試使用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