Direct Reports

Brian Welcker's Weblog

Alien Lanes (Logical and Physical Pagination Rules)

Alien Lanes (Logical and Physical Pagination Rules)

  • Comments 47

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.

  • In a previous post, I described some of the rules around report pagination. I mentioned that you can...
  • Good article
  • 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
  • Thanks for catching that error. I have corrected the post.
  • 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?
  • 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
  • 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.
  • 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.
  • 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!
  • 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.
  • 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.
  • 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.
  • 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.
  • 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.
  • 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?
Page 1 of 4 (47 items) 1234
Leave a Comment
  • Please add 5 and 8 and type the answer here:
  • Post