 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Matt Bollard Guest
|
Posted: Wed Apr 28, 2004 5:16 pm Post subject: Help with QR PageCount, please. |
|
|
Dear QR Experts:
I'm getting a weird bug. I am running a report, using a TADOStoredProc to
populate the report, and when I try to set a TQRLabel.Caption to the value
of the QuickRep1.QRPrinter.PageCount, it sometimes returns the correct
number of pages, but not always. Does anyone know why, have a fix, etc.?
Thanks,
Matt.
|
|
| Back to top |
|
 |
Dhaval Shah Guest
|
Posted: Thu Apr 29, 2004 12:57 am Post subject: Re: Help with QR PageCount, please. |
|
|
Matt Bollard wrote:
| Quote: | Dear QR Experts:
I'm getting a weird bug. I am running a report, using a TADOStoredProc to
populate the report, and when I try to set a TQRLabel.Caption to the value
of the QuickRep1.QRPrinter.PageCount, it sometimes returns the correct
number of pages, but not always. Does anyone know why, have a fix, etc.?
Thanks,
Matt.
|
Hi Matt,
are you calling QuickRep1.Prepare before getting the pagecount? (i
presume so, but just re-confirming).
Also, where are you getting the pagecount value (i mean, in which band?)
Ideally, it'd be immediately after prepare (before preview or print
statements).
HTH
---
Dhaval Shah
Sr. Software Developer
Perth, Australia
|
|
| Back to top |
|
 |
Matt Bollard Guest
|
Posted: Thu Apr 29, 2004 4:06 pm Post subject: Re: Help with QR PageCount, please. |
|
|
Hello Dhaval:
Thanks for looking at this, and trying to help. Your presuption is correct.
Here is my code:
QuickRep1.Prepare;
QRLabel1.Caption := QuickRep1.QRPrinter.PageCount;
The page number is always off the first time I run the report, but when I
run it after that the number seems to be okay. Any ideas?
Thanks,
Matt.
| Quote: | Dhaval Shah wrote:
Hi Matt,
are you calling QuickRep1.Prepare before getting the pagecount? (i
presume so, but just re-confirming).
Also, where are you getting the pagecount value (i mean, in which band?)
Ideally, it'd be immediately after prepare (before preview or print
statements).
HTH
---
Dhaval Shah
Sr. Software Developer
Perth, Australia
Matt Bollard wrote:
Dear QR Experts:
I'm getting a weird bug. I am running a report, using a TADOStoredProc
to
populate the report, and when I try to set a TQRLabel.Caption to the
value
of the QuickRep1.QRPrinter.PageCount, it sometimes returns the correct
number of pages, but not always. Does anyone know why, have a fix,
etc.?
Thanks,
Matt.
|
|
|
| Back to top |
|
 |
Matt Bollard Guest
|
Posted: Fri Apr 30, 2004 7:21 pm Post subject: Re: Help with QR PageCount, please. |
|
|
Hi all:
I found a quick and dirty fix to the problem, in case anyone else runs into
the same thing. If you call QuickRep1.Preview twice, instead of just once,
before you call QuickRep1.QRPrinter.PageCount, then it returns the correct
number of pages. If anyone out there knows of a cleaner solution, I'd
welcome it.
Thanks,
Matt.
"Matt Bollard" <mbollard (AT) hotmail (DOT) com> wrote
| Quote: | Dear QR Experts:
I'm getting a weird bug. I am running a report, using a TADOStoredProc to
populate the report, and when I try to set a TQRLabel.Caption to the value
of the QuickRep1.QRPrinter.PageCount, it sometimes returns the correct
number of pages, but not always. Does anyone know why, have a fix, etc.?
Thanks,
Matt.
|
|
|
| Back to top |
|
 |
Jim Albertson Guest
|
Posted: Sun May 02, 2004 3:37 am Post subject: Re: Help with QR PageCount, please. |
|
|
"Matt Bollard" <mbollard (AT) hotmail (DOT) com> wrote
| Quote: | Dear QR Experts:
I'm getting a weird bug. I am running a report, using a TADOStoredProc to
populate the report, and when I try to set a TQRLabel.Caption to the value
of the QuickRep1.QRPrinter.PageCount, it sometimes returns the correct
number of pages, but not always. Does anyone know why, have a fix, etc.?
Thanks,
Matt.
|
Quoted below from the QuickReport 4 (chm) help file:
QRPrinter.Pagecount
This integer property gives the number of pages in the currently completed
report.
It is read-only.
Adding the pagecount to a Report
It is necessary to make two passes -
1. ReportForm.Quickrep1.Prepare; // creates a metafle copy of the report
2. Execute code to set the label -
ReportForm.PageCountLabel.Caption := format( ' of %d',
[Reportform.Quickrep1.QRPrinter.Pagecount]);
3. Re-run the report
ReportForm.Quickrep1.Prepare;
ReportForm.Quickrep1.QRPrinter.Print; // prints the metafile
ReportForm.Quickrep1.QRPrinter.Free; // close down ...
ReportForm.Quickrep1.QRPrinter := nil; // ... clean up.
However, the above does not help me as I am doing
a Quickrep1.previewmodal, so calling Prepare
twice leads to strange appearances like label captions
repeating twice on the report.. about to give up..
Anyone have a solution?..
JA
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|