发布时间 : 2022-08-16 09:33:19.390|阅读 586 次
概述:本文主要介绍如何在FastReport.NET中将报告的一页打印成多份。
相关链接:
本文主要介绍如何在FastReport.NET中将报告的一页打印成多份。
如果您需要分几份打印报表的特定页面,我们必须使用编码。您可以从用户应用程序代码配置打印属性,也可以在打印对话框中手动配置。这使您可以选择报告的特定页面并设置副本数量。但是,问题是您只能设置要打印的所有页面的份数。这就是为什么我们必须将打印过程分成几个步骤才能达到目标。
假设您需要打印第二页的三份副本和其余页面的一份副本。所以我们将这个过程分为两个步骤:打印第二页和其余页面。
//We create a report var report = new Report(); //We create a data source DataSet data = new DataSet(); //We download the data from the file data.ReadXml("~/nwind.xml"); //We register the data source in the report report.RegisterData(data, "NorthWind"); //We download the report template report.Load("~/Master-Detail.frx"); //We prepare the report report.Prepare(); //We choose the second page of the report report.PrintSettings.PageNumbers = "2"; //We set a number of copies report.PrintSettings.Copies = 3; //We hide the print dialog box report.PrintSettings.ShowDialog = false; //We sent the report to print report.Print(); //We repeat the same steps for the rest of the pages of the report report.PrintSettings.PageNumbers = "1, 3, 4, 5"; report.PrintSettings.Copies = 1; report.Print();
因此,我们可以将必要的页面与其他页面分开打印。上述代码的唯一缺点是打印的页面会乱序。如果您仍需要按顺序打印页面,则必须将过程分为三个步骤:打印报告的第一页、第二页和其余页面。
本次FastReport.NET使用教程就介绍到这里了, 更多产品授权信息点击查看FastReport.NET价格,或者咨询慧都在线客服。
FastReport.NET技术QQ群:536197826 欢迎进群一起讨论