How to Display Page Number in Report Body of SSRS 2008 R2?

后端 未结 5 912
逝去的感伤
逝去的感伤 2020-12-06 07:01

I think a lot of developers are facing the problem of try to display page numbers by using SSRS 2008 R2.

There is an alternative solution <

5条回答
  •  渐次进展
    2020-12-06 07:34

    First Follow the steps 1 below to do pagination:
    1)
    1.1. Click the Details group in the Row Groups pane.
    1.2. From the Tablix member Properties pane, expand “Group”-> “PageBreak”.
    1.3. Set the “BreakLocation” to “End” and set the “Disable” property to the expression like below:

    =IIF(rownumber(nothing) mod 40=0,false,true)  
    

    The above point 1 is use to do pagination in Report output(Display only 40 records per page in output)

    2) use custom code:

    Public Function PageNumberno(val as integer) as String
         Dim str as String
         str =(val/40)
         Return str
    End Function
    

    3) Create Calculated column in Dataset and enter =0 in expression

    4) In 2 Calculated Column
    1)Pageno
    2)No
    in Dataset

    In Report Body use Expression for PageNo :

    =code.PageNumberno(Rownumber("DataSet1"))
    

    use Expression for No :

     =IIF(Instr(code.PageNumberno(Rownumber("DataSet1"))
    ,".")<>0,
    (Left(code.PageNumberno(Rownumber("DataSet1")),
    (Instr(code.PageNumberno(Rownumber("DataSet1")),".")-1))+1)
    ,code.PageNumberno(Rownumber("DataSet1"))
    )
    

    5)Right click and insert column on Right Side and in Column name add code in Text box

    =ReportItems!No.Value
    

    Note: No is calculated Field column name.

    6)Under AdvancedMode IN Row Group select Static and Set RepeatOnNewPage Properties to True

    In the Above Column created under point 5 will display correct page no in every page in body of the report

    I have Tried and its working Fine..Try it.

提交回复
热议问题