Search code examples
crystal-reports

Crystal page number


So I'm making a report that needs to be able to be faxed and have a cover sheet if needed. I've added a cover as the report header with a total page count. There's a page header that generates the [page n of m] but is prevented from showing on the report header using a "if (pageNumber=1) then true". Being that I don't want the [page n of m] to include the count for the cover sheet, decided to manually make a page n of m. When it prints on the page, the numbers are in a float format instead of int, how can I fix this. Here's the Crystal Syntax I'm using and output.

numbervar n := PageNumber - 1;
numbervar m := TotalPageCount -1;
stringvar page := "Page " + toText(int(n)) + " of " + toText(int(m));
page

output: "Page 1.00 of 3.00"

I initially tried doing a reset page count after the report header, but that made the [totalPageCount] on the cover sheet 1 instead of 4.

thanks for the help, David K.


Solution

  • Instead of ToText(int(n), just use ToText(n, 0).

    You can find information on the different syntax for ToText here