2018年9月13日 星期四

[學習][RDLC] 報表頁數 依照群組分頁 Reset Page Number in RDLC Report by group


It can be done actually, but not without adding some custom code to the report:
Shared reportGroup as String
Shared newPage  as Integer

Public Function ResetPageNumber(newGroup as String)
  If Not (reportGroup = newGroup)
    reportGroup = newGroup 
    newPage  = 1
  Else
    newPage  = newPage  + 1
  End If
  Return newPage
End Function
Then in the footer, add text box for page number and make it's value:
= Code.ResetPageNumber(ReportItems!TextBoxWithYourGroupNameOrID.Value)

參考:
https://stackoverflow.com/questions/23300494/reset-page-number-in-rdlc-report-by-group
https://www.codeproject.com/Questions/1195280/Resetting-page-number-if-group-changes-in-RDLC-rep

注意:
頁尾一次只能參考一個欄位,如需多欄位的話,可以在最內的群組做組合即可。
或者資料群已做好排序,只要按最內的群組做分頁也可以,因為會重新RESET。

沒有留言:

張貼留言