我正在尝试直接打印RDLC文件而不显示Microsoft Report Viewer,我已经按照MSDN的示例进行了操作但是现在,每次我调用LocalReport类实例的"Render"方法时,它都会抛出"所需的一个或多个参数"运行报告尚未指定." 例外.
谁能告诉我哪些参数是我错过的?或者如何找到有关此例外的更多详细信息?
LocalReport report = new LocalReport(); report.ReportPath = System.Windows.Forms.Application.StartupPath + "\\" + rdlcFileName; report.EnableExternalImages = true; ReportParameter[] reportParams = new ReportParameter[] { new ReportParameter("LogoAddress", settings.LogoFileName), new ReportParameter("FooterValue", settings.InvoicesFooter) }; report.SetParameters(reportParams); report.DataSources.Add(new ReportDataSource("Invoice", new PrintableInvoice[] { invoice })); report.DataSources.Add(new ReportDataSource("InvoiceItem", invoiceItems)); Warning[] warnings; try { string deviceInfo = "" + " "; m_streams = new ListEMF " + "8.5in " + "11in " + "0.25in " + "0.25in " + "0.25in " + "0.25in " + "(); report.Render("Image", deviceInfo, _CreateStream, out warnings); foreach( Stream stream in m_streams ) stream.Position = 0; } catch( Exception ex ) { System.Diagnostics.Debug.WriteLine(ex.Message); }
并且_CreateStream是:
private Stream _CreateStream(string name, string fileNameExtension, Encoding encoding, string mimeType, bool willSeek) { Stream stream = new FileStream(name + "." + fileNameExtension, FileMode.Create); m_streams.Add(stream); return stream; }
Gerrie Preto.. 15
我刚刚发现如果你将参数值作为空字符串传递,如参数="",它会给你这个错误
我花了一段时间
我刚刚发现如果你将参数值作为空字符串传递,如参数="",它会给你这个错误
我花了一段时间
在参数属性中允许null将解决此问题.