Alien Lanes (Logical and Physical Pagination Rules)


One of the things I see people getting confused about in Reporting Services is around page sizing. Not setting the correct properties can result in extra blank pages or improper paper orientation. Here are some general guidelines for setting page sizes.


The rules around page sizing depend on whether you are talking about physical pagination (used by the print control and the TIFF and PDF rendering extensions) or logical pagination (used by the HTML and GDI rendering extensions).


For rendering formats that render physical pages, set the PageHeight and PageWidth properties for the report to control the pagination. These can be set in the Report Properties dialog (available under the Report menu) along with LeftMargin, RightMargin, BottomMargin, and TopMargin.


One thing that is important to know is that setting the Body size at design time is not generally useful in controlling pagination. The body is simply the container for the collection of objects on the report. The design time size of the body represents the smallest amount of space that will be taken up by the report. However, if any objects grow as they are filled with data, the body will expand to contain them. Mostly, the body will grow taller (tables, lists, and textboxes are a few of the items that will cause vertical growth) but can also grow wider (matrices and autosized images can cause horizontal growth).


So, when does a physical page break occur? When the runtime size of the body (plus the page header and footer size, if they are defined) exceeds the specified page size (minus the margins). It’s important to understand that controls on the page that don’t look like they contain any information (a wide textbox) can cause a blank page to be added to the report if it exceeds the page boundaries. Page breaks can also be specified explicitly before or after instances of report items (rectangles, groups, data regions). There are also certain situations were we ignore explicit page breaks (e.g. inside subreports).


So what defines a portrait vs. landscape report? If the PageHeight is less than the PageWidth, then it is landscape, otherwise it is portrait. It is important to understand that Reporting Services has no notion of the rotation of the paper in the printer. It is up to the applications that consume the output (Acrobat reader, print control) to determine the correct printer settings to best render the specified page size.


Note that the DeviceInfo settings can be used at report rendering time to override the page sizes in the definition. This is how the client print control works when you change margins or page size. In SP2 and SQL 2005 Reporting Services, the default page sizes are extracted from the definition at publish time and written to the ReportServer database as custom properties on the report. While you can programmatically change these via the SetProperties method on the web service, they will be overwritten if the report is republished (unlike parameter and datasource information).


Logical pagination is a little bit different. In SQL 2000 Reporting Services, interactive rendering formats used the same PageHeight property to determine page breaks. Since there is no real page boundaries on web pages, it is only used as a guidelines to reduce the amount of data to put on a single page. SQL 2005 Reporting Services introduces the InteractiveHeight and InteractiveWidth properties to determine logical page breaks. Actually, InteractiveWidth is not used at all but may be in a future release. The nice thing about this is that if you don’t want pagination in the web at all, you can set InteractiveHeight to 0 and the processing engine will produce your report as a single logical page.


The Excel rendering format does not explictly support pagination. The page size and margins are mapped into the Excel document for printing within Excel. For these reports, you will need to specifically include page breaks to break the report into multiple worksheets.

Comments (54)

  1. Anonymous says:

    In a previous post, I described some of the rules around report pagination. I mentioned that you can…

  2. Anonymous says:

    Good article

  3. Anonymous says:

    You commented " If the PageHeight is greater than the PageWidth, then it is landscape, otherwise it is portrait".

    When I do this in SQL 2005, it still comes out portrait when going to PDF. It would seem that the PageWidth needs to be greater than the PageHeight. Is this correct?

    Scott Barrett

    Moffitt Cancer Center

    Tampa, Florida USA

  4. bwelcker says:

    Thanks for catching that error. I have corrected the post.

  5. Anonymous says:

    The limitation I find with RS page setup is that you can’t have a report or subreport with both portrait and landscape pages – a capability that is very useful in reports (especially for graphs!)

    This feature likely to make it into RS2005 at some point?

  6. Anonymous says:

    In SRS 2000 there is a problem when we have a report with many subreports. The page orientation of some of these subreports are Portrait and some are Landscape.

    When we view the subreports individually the page orientation is okay but when we view the main report that has subreports, the orientation of the combined report is same for the entire report.

    Is this thing fixed in 2005?

    I have not yet installed 2005 and dont know whether this has been fixed yet.

    These problems happen when we export the report to PDF format.

    If you have any idea abt this problem pl. do let me know.

    thanks.

    -Keyur

  7. bwelcker says:

    Yes, not being able to have reports with both portait and landscape in the same report is a limitation. Eventually, we will provide report "sections" which enable you to change page layout as well as different headers and footers. Not sure when this will be released.

  8. bwelcker says:

    Yes, not being able to have reports with both portait and landscape in the same report is a limitation. Eventually, we will provide report "sections" which enable you to change page layout as well as different headers and footers. Not sure when this will be released.

  9. Anonymous says:

    Hi, Brian,

    Our city government is converting Crystal Enterprise reports to Reporting Services. RS is a great product, but we’ve also found a pagination problem we can’t explain.

    When viewing one of the landscape-oriented reports through the Report Manager "print preview" feature, some of the users see interleaved blank pages — specifically, each even-numbered page appears blank — but other users see a correctly formatted report, without the blank pages.

    The source of the difference must be something local to a user’s PC, and not anything Report Manager is doing, but darned if we can figure out what it is! Is it different print drivers? If not, what entity is actually rendering the physical page view?

    Thanks for any light you can shed on this!

  10. bwelcker says:

    Morris, while you specify the default page size in the report definition, the actual page size is dependent on what printers the user has installed on their machine. The print control tries to find a closest match with the installed printers and then resizes according to what gets chosen.

  11. Anonymous says:

    Hi Brian,

    Well done. This explains a lot. Thanks.

    I have a question for you. How do subreports affect the pagination rules? I have a report that has 3 nested lists (list1 contains list2, list2 contains list3) with subreports in the innermost list (3). list1 breaks by State, list2 breaks by Type, then list3 contains the customer information. the 2 sub reports have different tables of customer related data. None of these objects have pagebreaks set for before or after, but list3 has keeptogether = True. If there are 3 customers that have a small amount of data that can fit on one page, I’d like to keep them all on one page, but the report page breaks for every customer, creating many more pages than I need. Any ideas?

    Thanks.

  12. Anonymous says:

    Hi Brian,

    Just an Update – I had 2 subreports and I found that the problem only occurred when one of them was included. I rebuilt that subreport from scratch and the report now page breaks appropriately.

    Sorry for any confusion.

  13. Anonymous says:

    It is frustrating and disappointing to see that the landscape/portrait mix does not work in SQL 2005 … Such a major release (after 5 years), and still not being able to fix a BASIC problem: not all pages should have the same orientation.

    In my opinion this is a major lack of functionality, and it costs our company money to convert now to Crystal Reports.

    Thanks.

  14. bwelcker says:

    I hate to break it to you, Jonathan, but Reporting Services has not been around for 5 years. The first version of the product was published in January 2004. SQL 2005 (finished about 1.5 years later) is really a minor release from a Reporting Services perspective. I understand that mixed page sizes are important, but there are many important features and we can’t always get to all of them.

  15. Anonymous says:

    Brian,

    Am finding the Alien Lines blog to be quite helpful. Definitely appreciate your participating vigorously in the other fora, besides your own page.
    We use RS on W2K/SQL2K, so we don’t have the printing improvements. Short of writing an algorithm to ‘measure’ the physical page, what can we fiddle with to avoid the extra blank pages? (I’m sure I’ll regret swearing this, but…) We really don’t seem to have any extra data overflowing the sides (the last column is numeric), and the design page length is less than 6″. We’re inside 8″ on width and the L/R margins are .25″. RS is definitely breaking group sections correctly, but always gives an extra page. We ARE requesting a break after a major grouping, and deliberately crowding the report into too narrow a printing space causes good page breaks , without extra pages (half the horizontal data on one page and the rest on the next)!
    Is there something to fiddle with that’s not obvious?

  16. Anonymous says:

    I don’t think only giving the InteractiveHeight a none zero value will make a paging report.

    I have a report with a table in it, I set InteractiveHeight with values e.g. 6in and 11in , but it doesn’t work, all data from database(about 1000 rows) show in one page(html)

    could you please give me more details on implementing pagination in html.

  17. Anonymous says:

    We’ve run into a problem when we try to print a report to a wide-carriage printer.  The paper is 14 x 11.  When we set the paper size to 14×11, SRS assumes that it is landscape and thus prints the report sideways.  I sounds like in your blog that you’re saying there’s a way to override this behavior and tell the client print to still print as if it’s portrait.  Are there any examples of how to do this?  The only way we’ve been able to get around this is to set the page size at 14×15.  This makes it print right, but kicks out an extra page, wasting one out of every two printer forms.  Any ideas?

  18. Anonymous says:

    Hi, I have a strange issue with landscape and Globals!PageNumber expression.

    I have a very basic report with some text boxes and dataset fields at the top of the body, and a table also in the body, which has the header repeated on each page.

    The "page n of n" prints out correctly, but only for portrait (calculates the TotalPages for portrait). When I print from the browser (I’m using URL Access with toolbar and menu turned off), and have page layout as landscape, I get the "portrait" page numbering, plus a partially empty page at the end of each of these "portrait" pages. Or to put it another way, I get a page break before the start of each new "portrait" page. Can’t get the table to just flow on and fill all the space on a page.

    Any ideas?

  19. Anonymous says:

    What should I be looking for if when rendering to a print format (tiff / pdf / "print button") I get the contents of a subreport on a seperate page, but when viewed in HTML or exported to Excel the supreport renders (as I want it to) within the list control contents?

    I have tried turning off all explict page breaks.

  20. Anonymous says:

    Hi,

    I am using Reporting Services 2000 with SP2 and have some issues regarding page breaks when a report is exported to Excel & print preview is selected.

    The report has a set of matrices with a page break after the last one. Below that there are 2 more matrices each with a page break after it. At the very bottom there is a final matrix which has 2 row groupings one of which has a page break at the end. This also has a column grouping and sub totals for both rows and groups.

    When exported to Excel and viewed in print preview there is a number of blank pages some with headers. When page breaks are reviewed in Excel it shows single blank pages with just the page header below each matrix. In the spreadsheet itself it seems to be a large blank row. The final matrix containing the group with the page break has the same effect but there is also a totally blank page to the right of the matrix without the page header.

    HTML and PDF formats are correct, body size is well within the margins of the report. Splitting out various matrices separately doesn’t make any difference – a deep empty row creating a blank page appears after a matrix, and the final matrix on it’s own always produces an extra blank page between every page of data for each group.

    Is there any way of exporting to Excel whereby there will not be any blanks?

    Any help would be greatly appreciated

    Thanks

  21. jdsantos says:

    Where can I find solution and example of solving blank pages problem?

  22. Anonymous says:

    I’m running into a problem when add dynamic elements to report elements, eg: an expression on visibility, toggles, etc. When I add these elements, I lose paging and the report becomes 1 massive page.

    Anything I can do to retain paging and these dynamic elements? I have page height & interactive height values set. Thanks.

  23. bwelcker says:

    The report processing engine does not repaginate based on toggled elements. We thought it would be too jarring to have items appear / disappear from the page when the user toggled. Therefore the pagination is based on the initial view.

  24. Anonymous says:

    I have the same issue as described by Mark B.   I have a main report with a table.   In rows 1-2 I have simple data fields from the select.  In rows 3-4 I have a subreport in each.   When I run the report and view in html mode it looks great!   When I try to export to PDF or print; the report page breaks just prior to the 1st subreport (row 3).    I can’t seem to fuigure out what setting could be causing this.   Any suggestions?

    Thanks!

    Gary

  25. Anonymous says:

    (Reporting Services 2000 issue)

    I have a report with a table in it. The table normaly displays large data in several pages. I want to display the whole report in a single page,  and I remove all page breaks. The report is still being displayed in several pages. To make my quesiton short, I want a single logical page report but several page physical report ( print pages). Any one who can help me to acheive my requirment.

    Thanks

  26. bwelcker says:

    There is an explicit KeepTogether on the subreport. Since it doesn’t fully fit on the page, it is getting pushed to the second page. We are working on more explicit control over KeepTogether. As a workaround, could you merge the subreport contents into the main report?

  27. bwelcker says:

    Elias, RS 2000 did not provide any control over the logical pagination. Unless you create 2 reports, I can’t think of any way to get what you are looking for.

  28. Anonymous says:

    Hi Brian,

    I don’t want to bother you with the technical details of our massive repagination problems.

    I’ve just sent our problem-RDL one week ago to Wei Lu in msdn managed Newsgroup on Reportingservices.

    He doesn’t have the data source to reproduce the problem.

    And we have to move on to solve customer’s business problems.

    There seems to be no help in one big SSRS-problem we face (all the smaller ones are resolved by now).

    Neither unmanaged nor managed MS-Newsgroup or the original RDL-Spec.-PDF or googling helps.

    I’ve consulted ALL available books on SSRS from Wrox, Manning, Wiley, SAMS…

    I’ve read newest SQL-online books of February 2007

    Who can explain the thing with the InteractiveHeight?

    With a Matrix we:

    – either get 3,000 rows on the first HTML-page

     (=waiting minutes in IE or receiving a total timeout in ReportViewer-Control in WinForm-App SQL-Server SP1 or SP2 didn’t remedy the problem)

    – or with InteractiveHeight = pageheight(21cm) plus the top+bottomMargins (1.5cm) = 22.5cm we get HTML and PDF-Export right

     (why to sum this up? With 21cm or any other smaller number, we receive the 3’000 lines!!)

     (but in Layout View there is every second page blank)

    Here on this very Brian’s Blog, James Zhou described the same problem over a year ago (January 18, 2006), one meter above.

    Please give us a link to where some MS-Engineer explains the nuts and bolts of HTML-Rendering and InteraciveHeight.

    We need to understand the tech-basics to adjust our special cases.

    Without understanding the inner workings, we try and try and try and waste our time (and yours).

    Thanks in advance.

    Yours Henry

  29. bwelcker says:

    Henry, is there any way that you can open an incident with our customer support staff (see http://www.microsoft.com/services/microsoftservices/srv_support.mspx)? There are specific rules about page breaks and InteractiveHeight which might not apply to your report definition.

  30. Anonymous says:

    Brian, we will really consider this.

    As member of the Empower for ISV program, we have four incidents per year included. But with so much trouble we had with Reporting Services we didn’t want to burn them to early this year (and there is a lot to come yet in 2007).

    Why should we pay with our annual incident-fee for your introduced features (haha).

    OK, no, don’t understand it wrong. We all  together work hard, do a great job and hopefully enjoy it.

    To understand Reporting Services one has to really invest a lot of energy. It’s like a post-graduation.

    Best wishes from Peru

    Yours Henry

  31. bwelcker says:

    Thanks for the feedback, Henry. Rendering is a really tough area and sometimes we fix one customers problem and break another one. I think that if it turns out that it is our bug, you can get the call credit back. Either way, its the best way to troubleshoot the issue.

  32. Anonymous says:

    Brian,

    Regarding your 11/25/2005 post on this article regarding ‘report sections’:

    I was searching for a solution to have both landscape and portait pages in a report.  I need a subreport to print out in landscape mode; or at the very least appear vertical on a portait page.

    Has any progress been made on this in any of the service packs to date?  Do you have any other info you can share on how to do this?  Thanks again!

  33. bwelcker says:

    There is no built-in feature for changing the orientation within a report. You could call the render method yourself and send them to the printer but I think you are looking for something easier.

  34. Anonymous says:

    I am using a matrix control in a report containing 2 subreports. The matrix control is present in one of the subreports.  When I export the full report into the PDF,if the matrix are rendered in a single page, the report is fine and there are no blank pages. But when the number of columns exceeds the first page and moves into the second page then there are 3 blank pages in the report for every page with content.

    This problem occurs only when I try to generate the whole report. No blank pages appear when I render subreports into PDFs individually.

    Please help!!

    Cheers!!

    Ravi

  35. bwelcker says:

    You are seeing a limitation with the PDF renderer. Once the page width is determined for one page, it is the same for all of them. I’m not sure why you are getting 3 extra pages (instead of 1) but try to keep other items from getting "pushed" by the edge of the matrix. We are working on getting better about blank pages in the future.

  36. Anonymous says:

    Hi Brian,

    Thanks for the reply. I think we have figured why the blank pages are coming. The number of blank pages are actually equal to the number of times the matrix scrolls over to subsequent pages. So, if the data to be redered is more and the matrix scrolls over to the 2nd page, then there is one blank page. If the matrix scrolls over to 3rd page, then there are two blank pages.

    The above is in line with the limitation that you have mentioned (width is determined for one page, it is the same for all of them).

    Having said that, isn't there any way of getting over this issue? We are using matrix since we have a requirement of dynamic columns and rows and cannot fix the number of columns.

    Pls advice

    Thanks

    -Ravi

  37. Anonymous says:

    Site – very comprehensive and meticulous from all sides, its good! Just excellent website, I sure!

  38. chenthorn says:

    I have had these paging errors when exporting to pdf before, where a blank page follows the rpt page. I have been able to fix those easily enough by adjusting the page width, table width, and margin values. But now I have a rpt where I have a blank page PRECEEDING the rpt page, and no amount of tweaking is getting rid of it. Any ideas?

    Thanks!

  39. Blake says:

    I’ve been trying to work out pagination for double-sided printing. I’m using the ReportViewer control to render a local report that will be printed duplex. The report is grouped and each group has a page break at the end. The problem is preventing the start of a group from printing one the back page of another group. For example:

    Page 1 (printed on front side of paper): group 1

    Page 2 (printed on back side of paper): more group 1

    Page 3 (printed on front side of paper): more group 1

    Page 4 (printed on on back side of paper): group 2  <— This is a problem

    This should be:

    Page 1 (front): group 1

    Page 2 (back): more group 1

    Page 3 (front): more group 1

    Page 4 (back): <This Page Intentionally Left Blank>

    Page 5 (front): group 2

    The solution in Crystal was to insert a hidden item after the group footer that would check to see whether it was on an even page and, if so, generate a second page break thus forcing the blank page. In SSRS, of course, the body is rendered first and thus doesn’t know what page it will be on.

    I can still add the hidden item and check for its existence in the page header. I can then check to see whether this is an even or odd page. The problem with this approach is that page breaks apparently cannot be generated in the page header/footer (I suppose to prevent the development of an infinite loop).

    Is there any pagination solution for two-sided printing? It would seem to be a common issue to me.

  40. BobP1339 says:

    I have a report with a list control on it.

    It is grouped on a record key.

    In this control I have 3 tables showing different aspects of the record for that record key.

    I have KeepTogether set to True for the list, however, it routinely splits the group at the bottom of a page.

    The groups are only about 1/3 of a page, so I would think that it would easily bump the offending group to the next page.

    Is there any reason the Keep together property would not work?

    Thanks

    BobP

  41. tnafoo says:

    i have a report with a blank page after each grouping. i took off page breaks for every items on the page but it didn’t work.

    after i read your article on setting page margins, i set all page margins to zero: topmargin = 0, rightmargin = 0, leftmargin = 0 and bottommargin = 0. and it’s now printing without blank page.

    thank you so much brian!

  42. zoomer says:

    Does setting InteractiveHeight to zero really disable pagination when viewing the report via a browser?  Are there any other properties that I must set to disable pagination?

    I have tried setting that property to zero, but my report still is two pages when I view it with my browser (IE7 or FF…. same results).  The page breaks occur exactly where I want them when I export to PDF, but a page break occurs in the middle of a table when I view the same report in IE.

  43. Anonymous says:

    In Reporting Services reports, page breaks occur when the size of the body exceeds the page size. The…

  44. jpk_jlp says:

    I’m trying to get the pagination in the web browser (Regular ReportServer view) to match the pagination of the printed reports.  So that a user can go to the page in the browser, then print only their page of the report.   I’ve tried adjusting the Interactive size, but it’s really hit or miss.  Any Ideas would be appreciated.

  45. Usha says:

    Am facing this problem.

    In a report one subreport is there after the subreport I took one table which is having a pagebreak.

    That means the subreport appears in one page and the table in second page,after exporting to excel,the top of the second sheet is coming up with a hidden blank row..

    I want to avoid that blank row at the top of the second sheet,Please help me

  46. littlejon3 says:

    Has there ever been any update on the forced page break before sub-reports?

  47. csbened says:

    SSRS – if a subreport is more than a page and included in an other report the whole thing is shown on a single page. How can we force SSRS to create a more pages based on subreport length ?

  48. Shankar.C says:

    HI….

        I need to set pagebreak in a table inside rdlc. table is having 3 groups. need to set page break after every 20 rows.that 20 rows should include  group header and footer rows…. any help.

    regds,

    Shankar.C

  49. Anonymous says:

    If you are using page break, make sure do not tick before or after page

  50. Anonymous says:

    I have a report which contains two reports.   A tablix of one-column and one-row contains both subreports. All works well but rendering (export) to pdf and tiff.  After the export , I see subreports texts are overlapping.  Is there any solution ?  Appreciate your input.

    Thanks,

    — Khan2011

  51. Anonymous says:

    Hi Brian

    I am having an issue where I have a report that displays the page # in the previews differently to the page numbers in print preview, I understand that HTML renderer displays using the InteractiveHeight but no matter what values i set InteractiveHeight I am unable to make it mimic display as it is done in print preview.

    Thanks

    -Clive

  52. Hi, Khan. I'm not really working on Reporting Services any more so I'm not familiar with the current behavior. I've posted your comment in case someone else is having the same problem. I would try the SSRS forums over on TechNet.

  53. Anonymous says:

    Hi Brian,

    I use ssrs 2008r2 for development. I was trying to regulate interactivesize and  pagesize. I made them the same, such as w=11 and H=8.5. Also I followed this formula:

    1. Width (interactivesize)+margin(L and R)=Width(pagesize)
    2. Height(Interactivesize) + margin(T and B)=Height(Pagesize), but there is still the difference in pagination between preview and  print. But all these did not help me to fix the issue.

    Thanks