翻譯|使用教程|編輯:董玉霞|2022-08-16 09:33:19.390|閱讀 751 次
概述:本文主要介紹如何在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使用教程就介紹到這里了, 更多產品授權信息點擊查看FastReport.NET價格,或者咨詢慧都在線客服。
FastReport.NET技術QQ群:536197826 歡迎進群一起討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn