gpt4 book ai didi

printing - 尚未指定运行报告所需的一个或多个参数

转载 作者:行者123 更新时间:2023-12-02 09:11:41 26 4
gpt4 key购买 nike

我正在尝试直接打印 RDLC 文件而不显示 Microsoft Report Viewer,我已按照 MSDN's example 进行操作。但现在,每次我调用 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 =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.25in</MarginTop>" +
" <MarginLeft>0.25in</MarginLeft>" +
" <MarginRight>0.25in</MarginRight>" +
" <MarginBottom>0.25in</MarginBottom>" +
"</DeviceInfo>";

m_streams = new List<Stream>();
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;
}

最佳答案

我刚刚发现您是否将参数值作为空字符串传递,例如parameter =“”它会给你这个错误

花了我一段时间

关于printing - 尚未指定运行报告所需的一个或多个参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/301679/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com