翻譯|使用教程|編輯:凌霄漢|2022-02-25 10:39:35.050|閱讀 485 次
概述:本文主要為大家介紹在FastReport.NET如何將報(bào)表中的一頁(yè)分開(kāi)打印,最新版本更新,歡迎大家下載使用!
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
在您使用FastReport .NET 報(bào)表生成器的過(guò)程中,如果您需要分幾份打印報(bào)表的特定頁(yè)面,我們必須使用編碼。您可以從用戶(hù)應(yīng)用程序代碼配置打印屬性,也可以在打印對(duì)話(huà)框中手動(dòng)配置。這使您可以選擇報(bào)告的特定頁(yè)面并設(shè)置副本數(shù)量。但是,問(wèn)題是您只能設(shè)置要打印的所有頁(yè)面的份數(shù)。這就是為什么我們必須將打印過(guò)程分成幾個(gè)步驟才能達(dá)到想要的效果。
現(xiàn)在假設(shè)一種情況,您需要打印第二頁(yè)的三份副本和其余頁(yè)面的一份副本,那么我們將這個(gè)過(guò)程分為兩個(gè)步驟:打印第二頁(yè)和其余頁(yè)面。
方法如下所示:
//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();
因此,我們可以將需要的頁(yè)面與其他頁(yè)面分開(kāi)打印。上述代碼的唯一缺點(diǎn)是打印的頁(yè)面會(huì)亂序,如果您仍需要按順序打印頁(yè)面,則必須將過(guò)程分為三個(gè)步驟:打印報(bào)告的第一頁(yè)、第二頁(yè)和其余頁(yè)面。
報(bào)表生成器FastReport .NET是適用于.NET Core 3,ASP.NET,MVC和Windows窗體的全功能報(bào)告庫(kù)。使用FastReport .NET,您可以創(chuàng)建獨(dú)立于應(yīng)用程序的.NET報(bào)告。
FastReport 技術(shù)交流群:702295239 歡迎一起進(jìn)群討論
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@ke049m.cn