Fastreport group page number

Source: Internet
Author: User


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.

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.