C# Crystal Reports Finding Last Page Number is Very Slow
I am generating ReportDocument has about 2500 or more pages. When I load
limited number of pages ie 1 to 60 it is fast.
But my Table has more than 2500 records to be displayed in the report. It
shows the Page number 1 Fast.
In Here, When I click the Crystal reports Print Button or Last Page Button
in the Toolbar, It is very Slow takes upto 5 Minutes to load the Print
Dialog
So I tried the Manual Printing like
private void btnPrint_Click(object sender, EventArgs e)
{
btnPrint.Enabled = false;
var report1 = (rptDoc)crView.ReportSource;
PrintDialog dialog1 = new PrintDialog();
dialog1.AllowSomePages = true;
dialog1.AllowPrintToFile = false;
dialog1.PrinterSettings.FromPage = 1;
crView.ShowLastPage(); // Stucks up Here and It takes very Long time
to Retrieve the Page Number.
int pg = crView.GetCurrentPageNumber();
crView.ShowNthPage(1);
dialog1.PrinterSettings.ToPage = pg;
if (dialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
int copies = dialog1.PrinterSettings.Copies;
int fromPage = dialog1.PrinterSettings.FromPage;
int toPage = dialog1.PrinterSettings.ToPage;
bool collate = dialog1.PrinterSettings.Collate;
report1.PrintOptions.PaperOrientation = PaperOrientation.Landscape;
report1.PrintOptions.PrinterName =
dialog1.PrinterSettings.PrinterName;
report1.PrintToPrinter(copies, collate, fromPage, toPage);
}
dialog1.Dispose();
}
How to print Fast the Whole Pages in my CrystalReportViewer.
Thank you for Watching..
Environment : Visual Studio 2008(.NET 3.5) Crystal Reports
No comments:
Post a Comment