How to add Page Numbers for each printed page SSRS? - reporting-services

I want to make it so that when you print a page in SSRS, it will correctly show you the number of each page you print out. Is that possible in ssrs?

You can simply add a footer (or header) to your report and use the Globals!PageNumber and/or Globals!TotalPages in a textbox. You can combine the two as well. So, add a footer to the report, add a new textbox and set the expression to
="page " & Globals!PageNumber & " of " & Globals!TotalPages
Note: The page numbers will differ from viewing on screen to printing as the interactive size is not always the same as the printed size.

Related

Display the number of groups in the report header, instead of footer

I use Access for quite some time (2013 now). Is there a way to display the number of groups in the header of a report, instead of the footer?
See image: I want number "4" to be displayed in the report header, also as part of a computed field's expression (ie. "Number of groups = 4"). It only works in the footer, using the "=1" computed field trick (running sum all), but when I drag it on the header it displays "1" instead of "4".
Could it be done using code in the report, if no other way is possible?
Thanks in advance.
my report with groups

how to hide blank space between textboxes when one of them is conditionally invisible in SSRS

My SSRS report has five text boxes, each arranged one below the other. The third text box has a visibility condition which will hide the text box in a few cases. Under such cases, there is a blank space shown between the first two and the last two boxes. Is there a way to hide this blank space without re-ordering them?
Thanks in advance !!
If you right click at the left hand edge of the tablix, you will find there is a 'Row Visibility' property.
Put the text box that you want to hide/show conditionally in it's own row, then hide/show the row, instead of the text box.
Like others were saying, you could combine them all into one textbox. It would look something like this:
=IIF(showText1 = true, vbcrlf & "Text 1" &, "") & IIF(showText2 = true, vbcrlf & "Text 2" &, "") & IIF(showText3 = true, vbcrlf & "Text 3" &, "")
Note: You'll probably want "Allow height to increase" and "Allow height to decrease" checked in your textbox properties as well when doing this

SSRS Adding fields in report headers/footers

I am wondering if there is a better way to have fields displayed in the report headers and footers. Currently we are doing this by adding the field to a tablix in the report body and referencing that in the header/footer
=ReportItems!ItemName.Value
This however means that there are a lot of hidden fields attached to the main tablix used in the report body and if the end user has to edit the report in the future for whatever reason then it is just confusing and complicated to navigate.
The reason that the fields displayed in the header and footer are attached to the main tablix used in the report body is so that we can take advantage of the grouping and page breaks set there so we can make the header update with different data across different pages within the same report
I know this way works and is probabily one of the easiest to implement but we have a lot of fields that need to be displayed in the headers/footers and the body of the report just looks a mess with lot's of tiny columns in the tablix all hidden. It also makes our tablix quite wide with all of the hidden rows that just make the report it self a lot wider than it should be .
Is this the correct way to do it or is there a better more intuitive way of displaying data in the headers or footers?
I can think of two other ways but normally in the header there should just be a title because its just a header. Everything else can go under the header and formated like you want it (with rectangles and page breaks for example).
So first of all you can use the page numbers to manage different headers. Put a textbox in the header and add the following expression:
=IIF(Globals!OverallPageNumber = 1, "This is the header for Page 1", "This is the header for Page 2")
You can also add a paramater to your report, where you manage different states to manage the headers. In the textbox goes something like:
=IIF(Parameters!HeaderParameter.Value = 1, "Sales haeder", "Work header")
The craziest I did was a header with two key informations:
="Sales Report " & CStr(Year(Now())) & " with an overall amount of " & Parameters!TotalsSales.Value & " EUR"
Everything else should go under the header I think. And if you need to display different tablixes with different information but each of them on a different page. You can add page breaks when you add a rectangle and go to Right click > Rectangle properties > General > Add a page break after.

SSRS-Handling different headers based on page number

Here is the similar imageI'm trying to create an SSRS report using SSRS 2008 R2.
I have a requirement to show different headers in different pages based on page number. For example, I need two textboxes to be shown in all the pages except page-1. So I put them in a rectangle inside report header and set the visibility(expression) based on pagenumber.
This works fine but it leaves a lot of white space in the first page header as it is hidden. How can I get rid of the whitespaces?
I tried putting those 2 textboxes out of the header, but I'm unable to hide them based on pagenumber, as the pagenumber global variable can be accessed only in header and footer but not from the body.
Is there any other approach to hide these textboxes on first page and show on all other pages?
Thanks in advance.
Update: added similar image
You can't recover the space in the header but you can not use it in the first place and let the text box grow when necessary. The bad part is that when it is exported to Excel, all the text will be in one cell.
Since your text is different sizes, you'll need to use HTML formatting.
In your regular header, add the page formula you are using with the TRUE part containing the text needed for your additional info and the FALSE part with an empty string - "". Use the <br> tag for a page break and the <font> tag to set the size.
="<b>This is My Page Header</b>" & IIF(Globals!PageNumber > 1, "<br><font size = '2'>Text Box 1" & "<br>" & "TextBox 2" & "<font>", "")
You'll need to set the Placeholder properties to Interpret HTML tags.

Force SSRS 2005 to print a new page

I have a field on the footer that may contain more text the the textbox would support. If it does, I need the report to print another page, even if it's completely empty, containing only the footer field.
Basically, if a condition is true, I want the report to print a new page, displaying my footer in it, even if there's nothing else to be printed.
How can I achieve this, preferably with field expressions?
And if you have a solution that's not a field expression (external code for example), could you also point me to the basics of it?
On any block you have the property PageBreak, you can choose begin, end or none. By choosing end, a page break will be insered after the block.
=iif(Globals!PageNumber Mod 2,True,False) this helped me to show (visibility) a text box on even pages only from my footer