The situation here appliesFastreport2.53Version.
The report page number is generally likeWordYou don't have to worry about it,FastreportDirectly from the system variables. However, in special circumstances, it cannot be easily obtained.
Here we talk about the page number of a group, that is, when the report group is used. First, each group is forcibly paged, and the page number is re-counted. For example5The page is divided into two groups, one group occupies2Page, the other group occupies3Page. Normally displayed as long
1/52/53/54/55/5
In this case
1/2
2/21/32/33/3
The page number is easy to calculate, and a variable is used to represent the page number. After grouping, You can recalculate the page number. The difficulty lies in the number of pages in the grouping, the basic idea is to use the report twice to obtain the total number of pages of each group for the first time, and then display the report for the second time.
define three variables first, gpage used to indicate that the initial page number is 1 , pagelist the initial value of the number of page numbers used to store groups is { 0} , gindex the initial value of the index used to calculate the group is 0 , fgind Ex used to calculate the group index for the second time, gindex one can be shared, but used separately for clarity.
InPagefooterOfBeforeprintWrite in
Gpage: = gpage + 1;
InGroupfooterOfBeforeprintWrite in
If finalpass then //Add group index for the second time duration
Fgindex: = fgindex + 1
Else
Begin
Setlength (pagelist, gindex +
1 );
Pagelist [gindex]: = gpage;
//Total number of pages for storing groups
Gindex: = gindex + 1;
End;
Gpage: = 0;
In this way, everything will be available.MemoEnter[Gpage].
InMemoWrite in the script section below
If not finalpass then exit;
Memopagecount. lines [0]: =
Pagelist [fgindex];
(Memopagecount
YesMemoName)
In this way, the group page number is met.