How to remove Page Header White Space in SSRS report for pages 2..x - reporting-services

We are trying to remove the white space taken up by the Page Header on every subsequent page after page 1. We don't have blank pages, just white space taken up by the header. It also doesn't seem to matter whether we send it directly to the printer or export it to a PDF.
On the Report section, we have set ConsumeContainerWhitespace = True.
On the Page Header section, we have PrintOnFirstPage = True
and PrintOnLastPage = False. Too bad there's not a
PrintOnlyOnFirstPage option!
We have two Rectangles on the Page Header section encompassing all of our header fields, and we've tried setting the Hidden property of these
rectangles to be:
IIF(Globals!PageNumber = 1, False,True).
We have several Text Box fields on the Page Header inside both rectangles. We are turning the visibility attribute of these Text Box fields either on/off depending on whether there's data present in the accompanying data field, e.g. =IIF(Len(First(Fields!SpecialOrderId.Value, "PurchPurchaseOrdersDS")) = 0, True, False).
I've tried the suggestion about putting the header code in the body and programmatically hiding it, but I'm getting this error:
\SSRS Reports\Reports\PurchPurchaseOrder : error AX3026: : PageNumber is invalid. InvalidIdentifier
THECODE:
Public Function PageNumber() As String
Return Me.Report.Globals!PageNumber
End Function
CALLING IT:
=IIF(Code.PageNumber() = "1", False,True)
Thanking you in advance.

Folks, I found a link on a webpage that said: "VB code is no more supported in AX2012-SSRS". Obviously this is why the PageNumber() function does not work for us. However, using Harry's suggestion of moving our header fields into the body of the report fixed our issue and we no longer have two inches of blank white space on pages 2..x! Thanks!

Related

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.

hiding and removing white space of header in ssrs report

I'm working on ssrs report,i need to hide the header on last page for that I did visibility changes to the controls inside the header whatever I used.
I used this code
=IIF(Globals!PageNumber = Globals!TotalPages - 1 or Globals!PageNumber = Globals!TotalPages ,true,false)
it's working fine.
but after hiding the header controls the header white space showing on last page. i need to remove the white space occupying by header is there any way to remove that.
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

Hiding Textbox in SSRS and freeing up space

I am designing a report using SSRS 2008 R2 where there can be 2-3 sub headers. Now the headers are passed as parameters showing different options such as date range etc.Now I have used three TextBoxes for the three headers but the problem is if I pass 2 headers and even if the third TextBox is hidden it takes up space. I would have used a tablix had the headers appeared in a body section but It seems I cannot use a tablix in the header section.
I hope I was able to make myself clear. Does anyone have any answers regarding this.
Thanks.
If I may make a suggestion, that I've used before, use placeholders. So, what you do is go into the box that is right before the optional text box. Then, right click. You should see an option at the bottom for Create Placeholder. Click that and it will ask you to create an expression. Do an IIF check on your variable.
Example: IIF(MyVar = 1, vbcrlf + "My Header", "")
What this will do is check to see if MyVar = 1. If it does, then it appends onto your text box a new line with the text "My Header". Otherwise, it will take up no space.
Please let me know if this helps and good luck with your project.
You have to 'play' with 3 properties of your TextBoxes.
CanGrow: True
CanShrink: True
Hidden: =IIf(Parameters!YourParameter.Value = "", True, False)
To save space, you can also set a minimum Height for your TextBoxes and put them attached to each other.
you have to change the visiblity:
1)select textbox
2)right click on text box.
3) go to Text Box Properties
4)visiblity tab>click on "fx" for expression and write following code.
use if condition:
=IIF(Cstr(Header.value))="",TRUE,FALSE)
i hope it will solve ur issue.

Repeating certain elements on new pages in SSRS

I'm pretty new with SSRS and I'm looking for a way to implement the following. I'm having a table that is expected to be rendered in multiple pages and I need to repeat an element in the report with every new page as in the shown image.
For example, if the table takes more than one page, what I need to do is to repeat the image in red and hide the image in green in the new pages.
I tried creating a subreport and adding those element to the headers but that didn't work. Obviously, the subreports headers and footers aren't rendered in the master report.
No need for subreport. Add a page header to your report (Report menu -> Add Page Header), and move the red box into the page header. In the body of the report put the green box, and then tablix/table. It should look similar to this in the design view:
In my case, I added a variable then insert code in Report Properties:
Public Function IsFirstPage(resident as string, currentResident as Microsoft.ReportingServices.ReportProcessing.OnDemandReportObjectModel.Variable) as Boolean
If (resident<>currentResident.Value) Then
currentResident.Value = resident
Return True
Else
Return False
End If
End Function
Then add Expression to Hidden element (your case is the image in green):
=IIf(Code.IsFirstPage(Fields!szFirstName.Value+Fields!szLastName.Value, Variables!currentResident), False, True)

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