问题
I want remove header and footer from specific pages e.g from 2nd 3rd page out of 5 pages because when we export it to excel sheet it will merge cells and the sorting of excel will not work on sheet 2nd and 3rd.
回答1:
I don't believe there is a way to remove the header/footer region from certain pages of the report. The only options SSRS gives is Print on First Page/ Print on Last Page options in the Header properties, so you can only control the first or last page of the report with those options.
You can hide the elements inside of the header/footer regions through their visibility property. For example, you could hide the header/footer contents on pages 2 & 3 by setting the visibility function to the following for the items inside the header/footer regions:
=Switch(Globals!PageNumber < 2,false,Globals!PageNumber < 4, true, Globals!PageNumber >=4, false)
By hiding the contents in those regions, excel will have a very narrow empty row at the top of the page, but at least it won't create the funky merged cells.
If you want to completely eliminate headers when exporting to excel, you can do so by following the instructions in this article I wrote:
http://jaysonseaverbi.blogspot.com/2013/11/ssrs-exporting-options-for-excel.html
回答2:
Jaysonseaver gives a good option. But, similarly, you could also do this by the Page Name. If you name your pages (such as for excel export the page name becomes the worksheet name), then the Page Name built in could also be quite useful.
Something like:
=IIF(Globals!PageName = "MyPageName", true, false)
来源:https://stackoverflow.com/questions/20103771/ssrs-rdl-header-and-footer-removal-from-specific-pages