Solved

crystal reports c# totalpagecount

Posted on 2004-03-24
3
790 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

695 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