[TotalPages] is 0 if user cancelled after Show()
I have this in the report's footer text:
footerText.Text = "[Page] / [TotalPages]";
This works normally fine, but if after the report.Show() the user cancels, this will be displayed as 1 / 0, 2 / 0 etc.
I found this in the manual that may indicate why:
"int Total
The number of total pages in a report. This parameter may be 0 when
preparing a report, because the number of total pages is unknown."
Is there still a way to have this number show correctly even if cancelled?
footerText.Text = "[Page] / [TotalPages]";
This works normally fine, but if after the report.Show() the user cancels, this will be displayed as 1 / 0, 2 / 0 etc.
I found this in the manual that may indicate why:
"int Total
The number of total pages in a report. This parameter may be 0 when
preparing a report, because the number of total pages is unknown."
Is there still a way to have this number show correctly even if cancelled?
Comments
have you tried cancelling double-pass report?
but i would expect you are cancelling before you are in the second pass.
mod this code
footerText.Text = "[Page] / [TotalPages]";
delphi e xample
if engine.finalpass then footerText.Text = "[Page] / [TotalPages]";
flse footertext.text ="nan"
I decided to do this then, if anybody is interested.
Rpt.Prepare();
if (!Rpt.Aborted)
Rpt.ShowPrepared(true,this);
Thanks for the help.
from documentation:
TotalPages#
Total number of pages in the report. If you join several prepared reports
into one package, this variable will return the number of pages in a
package. You don't need to use double pass to get the correct value.
This variable is actually a macro. It value is substituted when the
component is viewed in the preview window. That means you cannot use
it in an expression.
Page#
Current page number. If you join several prepared reports into one
package, this variable will return current page number in a package.
This variable is actually a macro. It value is substituted when the
component is viewed in the preview window. That means you cannot use
it in an expression.