Solved

crystal reports c# totalpagecount

Posted on 2004-03-24
3
788 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
When table data gets too large to manage or queries take too long to execute the solution is often to buy bigger hardware or assign more CPUs and memory resources to the machine to solve the problem. However, the best, cheapest and most effective so…
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…

740 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