I need to create a report and export it to .docx that shows the page number and total number of pages in the first page header (e.g. "1 of 5") and only show the page number in the header for all other pages (e.g. "2", "3").
What I've tried so far
Creating 2 text boxes in the header and setting their visibility to "=Globals!PageNumber=1" and "=not Globals!PageNumber=1" or "=Globals!OverallPageNumber=1" and "=not Globals!OverallPageNumber=1". Both text boxes either exist on all pages or don't exist at all.
Setting the header to not print on the first page, adding only the page number to the header and adding a text box with the expression
code.PageNumber & " of " & code.TotalPages
to the top of the report body and adding
Function PageNumber() As String
Return Me.Report.Globals!PageNumber.ToString()
End Function
Function TotalPages() As String
Return Me.Report.Globals!TotalPages.ToString()
End Function
to report code, because you can't use global variables in report body. But the text box in the body always shows "1 of 1" no matter how many pages there are.
Is there something I did wrong in my attempts that I don;t understand?
Is there another way of achieving the result I need?
I'm not sure which version of ssrs I'm using but solutions that work with any version would help me a lot.