翻譯|使用教程|編輯:凌霄漢|2022-02-25 10:39:35.050|閱讀 469 次
概述:本文主要為大家介紹在FastReport.NET如何將報表中的一頁分開打印,最新版本更新,歡迎大家下載使用!
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
在您使用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是適用于.NET Core 3,ASP.NET,MVC和Windows窗體的全功能報告庫。使用FastReport .NET,您可以創建獨立于應用程序的.NET報告。
FastReport 技術交流群:702295239 歡迎一起進群討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn