reporting-servicesheaderreportssrs-2008ssrs-2012

hiding and removing white space of header in ssrs report


I'm working on an ssrs report. I can hide the header on the last page with

=IIF(Globals!PageNumber = Globals!TotalPages - 1 or Globals!PageNumber = Globals!TotalPages ,true,false)

This works, but after hiding the header controls the header white space is still showing on the last page. How can I remove the white space?


Solution

  • You are hiding the controls on that expression so even if the controls are hidden then also the header is there. So that header is still occupying the white space. You can not hide header or remove that whitespace(As far as I know) but there is another approach you can try.

    Add your header content on the reports main body and set the visibility expression there.

    There is one catch though you can not access the PageNumber directly in the report body for that you need to Create functions in the code under the report properties:

    Page Number:

    Function PageNumber() As String    
       Return Me.Report.Globals!PageNumber    
    End Function
    

    Total Pages:

    Function TotalPages() As String   
       Return Me.Report.Globals!TotalPages    
    End Function