Skip to content

How to save space in RDLC Documents (dynamic header-height workaround)

December 5, 2011

As you may experienced, in RDLC Document Reports like Sales Order, Invoice, etc. You face the problem of loosing lot of space for header information, which mostly only need to be printed at the first page, but not on the following ones.

This is due to the lak of a dynamic Header Height, or like in classic report design, where you can have more then one header and only show them on first page / all other pages.

In RDLC we only have one Header Section with a fixed height. This brings us in situations where we have report layouts like this:


This is a W1 Standard Purchase Quote Report, the header information is printed on every page but most likely you would want to have that only printed on first page and on all other pages you want just a report title, date, page no. etc but not all info.

This can be achieved by a simple trick. You make the header as small as you would like it to be on repeating pages ( > page 1). To do this you need to move all necessary texboxes to the list of the body-section.

Sencond you need to manage the visibility of the Textboces you only want on page one to be displayed. Best is to use this kind of expression:

=Code.GetGroupPageNumber(ReportItems!NewPage.Value,Globals!PageNumber) > 1)

After that process the layout should look something like this: (This is another report and has customer changes, but you’ll get the point..)


This is the basic concept, witch this you have different headers for different pages.

This can make problems when used with inside document page breaks (like in DACH version) where you manually break pages based on for example a sales line type. This can lead to the header being showed after such a break. To resolve this issue you simply put all body texboces in a rectangle, the put this rectangle in a new table header. In this Header you set the hidden expression to something like this:

=(Cstr(First(Fields!Sales_Line___No__Caption.Value)) > "")

You can take any Value of the lines, they must all be empty on printing of page 1.

The result at the end looks like this:

Advertisements

From → Dynamics NAV, RDLC

9 Comments
  1. Brilliant idea! There are quite a few bits of sql reporting services properties that can be used in Dynamics NAV RDCL reports.

    Thanks for sharing.

  2. Michael Schneider permalink

    Perfect, now I only need a solution for “Page x of y” in RDLC Layout.

    • Yeah, that one would be nice, but i gess it’s impossible to do with the current reporting version

      • Michael Schneider permalink

        Really, I hoped, that you can give some hints to do this.

        • Hmm i thought i read about it being not possible… But it looks like it is: Try =Globals.PageNumber + ‘ of ‘ + Globals.TotalPages
          Only works in Headers of cource

      • Michael Schneider permalink

        That works (with some modification). But if you have a document where you can print copies, the GroupPagenumber is not calculated correctly.
        I try my best to find a solution and let you know.

        • If the Textbox NewPage is set correctly it should work with Code.GetGroupPageNumber, for total page no. you should be able to use GetGroupPageNumber too!

      • Michael Schneider permalink

        I got it working. The GroupPagenumber wasn’t calculated correctly, because the textfield with “Globals!TotalPages” was below the textfield with th Pagno. it must be above or in the same line.
        Now I wrote a new function for calculating GroupTotalPagenumber.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s