正在.rdlc上进行直接打印(没有预览)(参考:Print a ReportViewer Without Preview)。我无需打开ReportViewer就能直接打印到打印机。我陷入一种奇怪的状况。上面提到的解决方案在Windows 7中效果很好,但是在Windows 10中会生成错误“未指定某些参数或凭据”。此错误在
上生成ReportPageSettings reportPageSettings = report.GetDefaultPageSettings();
我已经测试了与Windows 7相同的代码。迁移到Windows 10会产生此错误。
我尝试过 1)
Dim lrpt As New LocalReport()
lrpt.ReportEmbeddedResource = "POS-Rest.Invoice.rdlc"
Dim rds As New ReportDataSource("InvoiceDataSet", SelfDetailsBindingSource)
lrpt.DataSources.Add(rds)
lrpt.Refresh()
lrpt.ExecuteReportInCurrentAppDomain(System.Reflection.Assembly.GetExecutingAssembly().Evidence)
Dim rpt As New ReportPrintDocument(lrpt)
rpt.Print()
2)
Dim rpt As New ReportPrintDocument(Me.ReportViewer1.LocalReport)
rpt.Print()
检查错误屏幕截图 !http://prntscr.com/nj4s49