# Get Pagination Info

A tutorial showing how to get pagination info from the paginated render mode in a SpreadJS ReportSheet

## Content

Pagination details in a report can be retrieved with the `R.CURRENTPAGE` and `R.PAGECOUNT` functions, which work at both the report level and the group level.

>type=note
> **Note:** Support for **group‑level pagination** is available starting from **v19**, and only available for row pagination in Master-Detail reports.

## Pagination Functions

* `R.CURRENTPAGE(use_grouped_context)`
    * **Description**: Returns the current page number.
    * **Parameter**: `use_grouped_context` *(optional, boolean, default false)*
        * If `true`, returns the current page number within the current Master-Detail group.
* `R.PAGECOUNT(use_grouped_context)`
    * **Description**: Returns the total page count.
    * **Parameter**: `use_grouped_context` *(optional, boolean, default false)*
        * If `true`, returns the total page count within the current Master-Detail group.

>type=note
> **Note**: Starting with v19, the `R.PAGESCOUNT` function has been renamed to `R.PAGECOUNT`. The previous name (`R.PAGESCOUNT`) is still supported for backward compatibility.

## Examples

### Get Global Pagination Info

The following example displays the current page number together with the total page count.

```auto
// Formula of E6
=CONCAT("Page ",R.CURRENTPAGE()," of ",R.PAGECOUNT())
```

![image](https://cdn.mescius.io/document-site-files/images/b2223940-43c2-44cf-8eda-f5ab9acd84f0/image-20251225.19c5de.png?width=600)
The orders report generated from the above TemplateSheet is shown below.
![image](https://cdn.mescius.io/document-site-files/images/b2223940-43c2-44cf-8eda-f5ab9acd84f0/image.99dbf9.png?width=600)

### Get Group Pagination Info (Master-Detail only)

This example shows how to display both the overall report pagination and the pagination within each group.

```auto
// Formula of E5
=CONCAT("Page ",R.CURRENTPAGE()," of ",R.PAGECOUNT())
// Formula of E6
=CONCAT("Page ",R.CURRENTPAGE(TRUE)," of ",R.PAGECOUNT(TRUE))
```

![formula](https://cdn.mescius.io/document-site-files/images/b2223940-43c2-44cf-8eda-f5ab9acd84f0/formula-20251225.f0fcb8.png?width=600)
The orders report generated from the above TemplateSheet is shown below.
![image](https://cdn.mescius.io/document-site-files/images/b2223940-43c2-44cf-8eda-f5ab9acd84f0/image.12212b.png?width=600)