Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to get the sum of the pgaes?

36 views
Skip to first unread message

msd

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
Hello,all:
I have tried to use QRExpr control. It's expression is:
Max(pagenumber),but the result is the current pagenumber. And
I have tried using form.QRPrinter.PageCount and its result is
also the current pagenumber. I want to get the sum of the all
pages.
Who can tell me. Thanks.
Dong.

Peter Bossier

unread,
Aug 23, 1999, 3:00:00 AM8/23/99
to
As far as I know it is currently not supported. You can however .Prepare the
report, read the PageCount property (which should be the last pagenumber
now) and then set the caption of some TQRLabel before you print or preview
it for the second time.

Peter

msd heeft geschreven in bericht <37C106CA...@home.sti.jnu.edu.cn>...

msd

unread,
Aug 24, 1999, 3:00:00 AM8/24/99
to Peter Bossier
Thanks,Denissenko Sergey also told me such idea.

I have tried in this way too, but the result is 0.

why? Who can tell me?

msd

unread,
Aug 24, 1999, 3:00:00 AM8/24/99
to m...@home.sti.jnu.edu.cn
Hello,

I used a integer variable "Sum_pages" in the frmReport. And
in it's OnStartPage event, Sum_pages:=PageNumber. Then after
prepare , I show the Sum_page , the result=0 , and run again the
result is 2(it's right).
I found that when i show the Sum_pages the prepare hasn't ended.
So it show 0 and the second time it shows the right answer because
prepare procedure has ended. So I think why the result is 0 as blow:

QuickRep1.Prepare;
QuickRep1.ReportTitle := 'This report has ' +
IntToStr(QuickRep1.QRPrinter.PageCount) + ' pages';
QuickRep1.QRPrinter.Free;
QuickRep1.QRPrinter := nil;
QuickRep1.Preview;

may be when it show the pagecount the prepare procedure had not ended.

Can you tell me how to descide when the prepare is ended? Or if I
can't I think I have to run preview 2 times to solve such problems. The
first time i get the total pages of the report and the second time I will
use the right count. But there will be a new problem. I dont't know how I
can close the preview window and preview again?

Help me , please.

Your friend , dong.


Angshu

unread,
Aug 24, 1999, 3:00:00 AM8/24/99
to
Hi hope this helps though i never tried it ...:)
drop TQRSysData and set its data property to qrsPageNumber .. capture the
onprint event of the control ... the Value Parameter is a string .. comes in
the form say "2 of 30" .. take out the last whole letter (30) which is the
max page number .. and convert to string


msd wrote in message <37C21D95...@home.sti.jnu.edu.cn>...

msd

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to Angshu
Oh,Angshu,I had tried it. During its onprint procedure
I used the showmessage(value),but the result is 1,2,3,4...,
not '1 of n' .
I had no idea about that . Help me!!

Dong.

Angshu

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
try this ...

TQuickRep.QRPreview.QRPrinter.PageCount

Hope this helps
regards/angshu


Paulo Dias

unread,
Aug 25, 1999, 3:00:00 AM8/25/99
to
Hi,

Try to put an "Application.ProcessMessages" just after de "Prepare"... Tell
me if it works.

Best regards,

Paulo Dias
IBM Global Services
Rio de Janeiro - Brazil


msd

unread,
Aug 26, 1999, 3:00:00 AM8/26/99
to Paulo Dias
Thanks,but it doesn't work. When i put a long loop after "prepare..", I

can get the exact result but i don't know when i will end the loop. Can you

help me.

Angshu

unread,
Aug 27, 1999, 3:00:00 AM8/27/99
to
sorry about the last mail i sent you .. i made a mistake ... for i created
my own custom preview and put a TqrPreview in it ....

actually it should've been ...

MyReportForm.QuickRep.Prepare;
m_nPageCount := MyReportForm.QuickRep.QrPrinter.PageCount;

I am looking at a report which results in more than 15 pages at this moment
.. which has got two Group bands (nested) ... (may be your substitute for
loop band)and a subdetailband ...

and instead of straight away calling
MyReportForm.QuickRep.Preview;

if i write the above written lines it works just fine ...

Hope this helps ...
if you can work it out someother way ... would you please let me know?
Thanks
Regards/angshu

Angshu wrote in message <7q0es8$lf...@forums.borland.com>...

0 new messages