SSRS Report - Different Page Header and Footer in first page

Arbrian 1 Reputation point
2022-09-27T18:20:14.977+00:00

Hi,

  1. I want a Fancy header and footer in the first page and a different header from 2nd page onwards.
  2. Also my first page has a table at the end of the page and depends on the number of items in it, it may go to 1 or 2 pages.
  3. So basically the 2nd page should start all after these items in the table.
  4. The first page can go 1 or 2 pages long based on the number of items in the table and it should show the same fancy header on all these pages
  5. 2nd page with a different header should start only after the above mentioned 1st page(s)

Is this possible in SSRS RDL reports? If yes, how?

Thanks

SQL Server Reporting Services
SQL Server Reporting Services
A SQL Server technology that supports the creation, management, and delivery of both traditional, paper-oriented reports and interactive, web-based reports.
2,797 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Richard Uchytil 16 Reputation points
    2022-09-27T19:07:53.3+00:00

    This will be the same for header and footer.

    There are a couple options. One is to have two rectangles that are tight up against each other. One rectangle will have what you want to display on Page 1, the other will have what you want to display on the rest of the pages.
    245261-image.png

    Then you want to set the visibility for each rectangle so one shows only when the page number = 1 and the other shows only when the page number > 1. Here's the visibility expression for Footer 2: =Globals!PageNumber = 1 (this says to hide Footer 2 when the page number = 1 - when this expression is true this will be hidden).

    The rectangles have to be tight against each other or you'll have a blank space where the hidden rectangle is. I wish Microsoft would make it easier to do that instead of dragging very slowly watching the points until they get to zero.

    You can ALSO put the rectangles right on top of each other with the same visibility settings. I find that a little harder to edit but it works just fine.

    Another option is to have the textboxes in your header/footer have an expression that says something like, =IIF(Globals!PageNumber = 1,"Page 1 stuff","Page 2+ stuff").

    Which option is best? Really depends on what you're trying to do. Based on what you said you are wanting to do, I think two rectangles would be the better way. Let me know if you have any questions. :)


  2. Joyzhao-MSFT 15,566 Reputation points
    2022-09-28T02:54:37.547+00:00

    Hi @Arbrian ,
    One possible way is to use the built-in field "Globals!PageNumber" and the IIF Function.
    Suppose I need to display Image on Page1, Image2 on Page2 and later, stack two images in the same position.
    Set the visibility of Image1 to:

    =IIF(Globals!PageNumber=1,False,True)  
    

    Set the visibility of Image2 to:

    =IIF(Globals!PageNumber>1,False,True)  
    

    The preview is shown below:
    Page1:
    245335-01.png
    Page2:
    245354-02.png
    Best Regards,
    Joy


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  3. AniyaTang-MSFT 12,311 Reputation points Microsoft Vendor
    2022-09-28T06:04:05.92+00:00

    Hi @Arbrian
    If you want the second page to start after the table at the end of the first page, then you can try checking "keep together on one page if possible" in the Tablix property of the table.
    245392-1.png
    Questions about headers and footers, I agreed with Joy and Richard. You can use "Globals!PageNumber" to set the visibility of textbox, image, etc. You can also use it to set different properties.
    Set the value of textbox to:

    =IIf(Globals!PageNumber=1,"Welcome to this report","page number: "&Globals!PageNumber)  
    

    Set the font color of textbox to:

    =IIf(Globals!PageNumber=1,"red","black")  
    

    Preview:
    245401-2.png
    245402-3.png
    Best regards,
    Aniya