C# 仅打印第一页
我正在使用LocalReport.Render技术从Windows窗体应用程序打印报告,如下所述: 它可以工作,但只打印第一页。我没有在报告页面上使用任何页眉或页脚,只使用正文。没有子关系,没有子报告。只是一个非常简单的数据对象列表 我正在这样做,以便将数据源加载到报表中:C# 仅打印第一页,c#,winforms,reporting-services,rdlc,localreport,C#,Winforms,Reporting Services,Rdlc,Localreport,我正在使用LocalReport.Render技术从Windows窗体应用程序打印报告,如下所述: 它可以工作,但只打印第一页。我没有在报告页面上使用任何页眉或页脚,只使用正文。没有子关系,没有子报告。只是一个非常简单的数据对象列表 我正在这样做,以便将数据源加载到报表中: List<mysimpledataobject> MyData = new List<mysimpledataobject>(); ... add 10 items to the list ... r
List<mysimpledataobject> MyData = new List<mysimpledataobject>();
... add 10 items to the list ...
report.DataSources.Add(new ReportDataSource("Sales", MyData));
m_streams列表中只有1项,因此仅打印1页
我还尝试将DataTable和业务对象数组作为数据源传递,但这也不起作用
任何想法都将不胜感激。谢谢。如果要呈现报告的所有页面,需要在
DeviceInfo
中将0设置为StartPage
设置
StartPage
和EndPage
的默认值为1。这就是为什么总是只渲染第一页
例如:
string mime, encoding, fileNameExtension;
string[] streams;
Warning[] warnings;
byte[] bytes = report.Render("IMAGE", @"<DeviceInfo><OutputFormat>TIFF</OutputFormat><StartPage>0</StartPage></DeviceInfo>", out mime, out encoding, out fileNameExtension, out streams, out warnings);
字符串mime、编码、文件名扩展名;
字符串[]流;
警告[]警告;
byte[]bytes=report.Render(“图像”@“TIFF0”、输出mime、输出编码、输出文件名扩展、输出流、输出警告);
一些想法:您尝试过渲染到PDF吗?也许可以改变打印机,甚至可以尝试像PdfWriter这样的东西?
string mime, encoding, fileNameExtension;
string[] streams;
Warning[] warnings;
byte[] bytes = report.Render("IMAGE", @"<DeviceInfo><OutputFormat>TIFF</OutputFormat><StartPage>0</StartPage></DeviceInfo>", out mime, out encoding, out fileNameExtension, out streams, out warnings);