Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/333.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 仅打印第一页_C#_Winforms_Reporting Services_Rdlc_Localreport - Fatal编程技术网

C# 仅打印第一页

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

我正在使用LocalReport.Render技术从Windows窗体应用程序打印报告,如下所述:

它可以工作,但只打印第一页。我没有在报告页面上使用任何页眉或页脚,只使用正文。没有子关系,没有子报告。只是一个非常简单的数据对象列表

我正在这样做,以便将数据源加载到报表中:

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);