在您使用FastReport .NET 表生成器的过程中,如果您需要分几份打印 表的特定页面,我们必须使用编码。您可以从用户应用程序代码配置打印属性,也可以在打印对话框中手动配置。这使您可以选择 告的特定页面并设置副本数量。但是,问题是您只能设置要打印的所有页面的份数。这就是为什么我们必须将打印过程分成几个步骤才能达到想要的效果。
现在假设一种情况,您需要打印第二页的三份副本和其余页面的一份副本,那么我们将这个过程分为两个步骤:打印第二页和其余页面。
方法如下所示:
//We create a reportvar report = new Report();//We create a data sourceDataSet data = new DataSet();//We download the data from the filedata.ReadXml("~/nwind.xml");//We register the data source in the reportreport.RegisterData(data, "NorthWind");//We download the report templatereport.Load("~/Master-Detail.frx");//We prepare the reportreport.Prepare();//We choose the second page of the reportreport.PrintSettings.PageNumbers = "2";//We set a number of copiesreport.PrintSettings.Copies = 3;//We hide the print dialog boxreport.PrintSettings.ShowDialog = false;//We sent the report to printreport.Print();//We repeat the same steps for the rest of the pages of the reportreport.PrintSettings.PageNumbers = "1, 3, 4, 5";report.PrintSettings.Copies = 1;report.Print();
因此,我们可以将需要的页面与其他页面分开打印。上述代码的唯一缺点是打印的页面会乱序,如果您仍需要按顺序打印页面,则必须将过程分为三个步骤:打印 告的第一页、第二页和其余页面。
FastReport .Net | 下载试用
表生成器FastReport .NET是适用于.NET Core 3,ASP.NET,MVC和Windows窗体的全功能 告库。使用FastReport .NET,您可以创建独立于应用程序的.NET 告。
FastReport 技术交流群:702295239 欢迎一起进群讨论
标签:
声明:本站部分文章及图片源自用户投稿,如本站任何资料有侵权请您尽早请联系jinwei@zod.com.cn进行处理,非常感谢!