Solved

crystal reports c# totalpagecount

Posted on 2004-03-24
3
749 Views
Last Modified: 2007-11-27
Hi
I have a c# application that interfaces with various crystal reports
I need to be able to get the total page count of a crystal report.

I cannot seek to the last page because the table that the report is reading from is 500,000+ records
I am not accessing the crystal reports viewer just the report document.

My intentions are to print the entire report (40,000 + pages)
I would like to burst the report into 1000 page increments and then send the print jobs to different printers
(I will alternate between 2 printers).
I have already written code to burst the report based on different fields in the report but I do not kow how to get the number of pages. So I can stop the printer job. When I need to.

Any help would be appreciated.
0
Comment
Question by:janiescrinc
3 Comments
 

Author Comment

by:janiescrinc
ID: 10757995
Okay, I figured this one out...

as I loop through the pages in an infinite loop. when the startPage exceeds the total number of pages to be exported
an exception is thrown.
I catch the exception and automatically finish printing.
________________________
int batchSize= 1000;
int StartPage= 0;
int EndPage = 0;
try{
   while (1){

   ...
   endPage = endPage + batchSize;
   reportDoc.PrintToPrinter(printerName,startPage,endPage,...);
   startPage = endPage+1;
  ...
  }//end while
}Catch(PrinterException pe){
   ErrorMessage = e.Message();
}

____________________
What will happen with the code above.
Example: Crystal Report Document: 10 pages
BatchSize: 3 pages

1st Run Through >> pages 1-3 are printed (page ranges 0-3)
2nd Run Through >>pages 4-7 are printed (page ranges 4--7)
3rd Run Through >> pages 8-10 are printed (the page ranges 8--11)
4th Run Through >> PrintException Thrown



0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 11023286
PAQed, with points refunded (500)

PashaMod
Community Support Moderator
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Shadow IT is coming out of the shadows as more businesses are choosing cloud-based applications. It is now a multi-cloud world for most organizations. Simultaneously, most businesses have yet to consolidate with one cloud provider or define an offic…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now