Managing Reporting Services Layouts using the Rectangle in SSRS

Left a bit, right a bit

When it comes to designing one page summary dashboards for print (A4), you need to be able to ensure that the layout of your report is constant. Even with fluctuating columns & rows – care of Tables & Matrices. Initially this sounds fairly simple, add the report items, lay them out according to the design requirement and off you go. Preview. Whoa. WTH!

The problem arises when position of items on the report is affected by the growth of either a table or a matrix, either on the horizontal or vertical axis. Specifically, if the top one of your report items (the chart in Fig 1.) is below the bottom of another item (that can grow vertically), then it will be pushed out at run time. See fig 2.

Fig 1. The Design time Layout

Fig 1. The design time layout

Fig 2. The Runtime Layout

Fig 2. The run time layout

Have no fear, the rectangle is here!

Enter the simple rectangle report item. By using rectangles to layout your report and group certain items, you can retain the layout you worked so hard to achieve. How does it does this? The rectangle groups report items within itself, i.e. the growth of tables & matrices are relative to the rectangle and not the page itself. By adding two rectangles to the report I have grouped the Pie chart title and the pie chart, and have isolated the table. The table’s rectangle is also extended to the approximate depth of table at run time, thus ensuring that the planes of the report items relative to the design surface (the two rectangles) are the same.

Let’s have a look at the difference from Fig 1. & 2. In the Figs. below.

Fig 3. The design time layout using the rectangle report item

Fig 3. The design time layout using the rectangle report item

Fig 4. The runtime layout using the rectangle report item

Fig 4. The run time layout using the rectangle report item

But beware…

One important bit of information. You must ensure that the report items you wish to control are placed ‘into’ the rectangle. What I mean here, is that you cannot simply place a rectangle object over the report items you wish to constrain – this will give rise to overlapping objects and may result in error. The trick is to either place the rectangle on the design surface first and then drag-and-drop report items ‘into’ it, or for existing report items, place the rectangle onto the design surface and then cut the report items you wish to constrain, select the rectangle, and then paste the report items ‘into’ it. You can test that the report items are ‘inside’ the rectangle by selecting it (the rectangle) and moving it. If the report items (inside the rectangle) all move together, you have constrained them correctly.

Another note. The rectangle will not stop the growth of the tables & matrices, what it does is ensure that the layout of the rest of the report items are not thrown out at run time.

The data in the report is from the AdventureWorks database and is for illustration purposes only.

.

34 thoughts on “Managing Reporting Services Layouts using the Rectangle in SSRS

  1. Great, The Beware tip helped me, thanks a lot, any chance we could set the rectangle be in fixed height no matter what the conent inside it shrinks or grows

    • Hi Fareeth,

      Glad you noticed that little gotcha. As far as I am aware, you cannot fix the size of the rectangle through properties. You can however, fix the minimum height/width of the rectangle by placing a line item at the point at which you want to constrain the rectangle. This is a bit of a work around, but will get what you want. I don’t believe you can set a maximum size constraint on the rectangle though.

  2. Can you force the rectangle to always take up the space that it is give? I have a report that prints in thirds of a page. Main is top 1/3, then a subreport for the middle and another subreport at the bottom 1/3. I have the subreports placed correctly and they move when I move the rectangle but the bottom 1/3 starts printing directly below the middle section rather that at its designated location.

    • Hi David,

      As per the comment just above yours….

      You can force the rectangles to a certain size, as long as that size is bigger than the object which it contains. It’s a bit of a hack but, place line object on the right-hand extreme and one on the bottom extreme. Make these Lines transparent to hide them when the report renders. The lines will limit how much the rectangle auto-sizes and will ensure that the rectangle holds its intended shape.

      With regard to printing; See this post about sizing your page correctly

  3. Hi Luke,

    First let me thank you for giving back to the community! Not many people take the time these days to help others, so thanks! ;-)

    I am new to the SSRS thing as I have always Crystal Reports, but this time I do not have that option. I have read the latest iteration of SSRS is very powerful, but I cant even get some of the simplest things to work right.

    When using the Report Builder it only allows you to save to the “.rdl” extension. Can Report Builder 3.0 save to “.rdlc”? Can “.rdl” be converted to “.rdlc”?

    The “Interactive Page Size” and “Page Size” properties for a blank report specify the standard letter size of “8.5×11″. However, the “Body” section of the report defaults to “6×2.25″. I really dont understand the purpose or implications of this, nor do I understand “Interactive Page Size” versus “Page Size”

    I am sure all of this info is buried in many places on the web, but your succinct explanation of your initial post leads me to believe that you could boil this all down to a simple answer.

    Thanks Luke!
    Jim

  4. Thanks for the ‘beware’ bit – I’ve been working on a particularly fiddly problem which I’ve solved before using rectangles but it wasn’t working for me til your post reminded me of the basics, which is exactly what I needed. Thanks!

  5. Wow… this rocks. I wish there were more easily explained tips like this on the web when I need them! Thanks!!

  6. I have several rectangles with text within each. If I need to move the rectangles around, is there an easy way like in Crystal Reports to select all objects and move them and still keep their placement within the rectangle from moving?

    • Hi Sandy,

      You can hold down Ctrl and then click on each of the rectangles. You will then be able to move them as a group.

  7. Thank you for the interesting blog here.

    with you comment

    “Another note. The rectangle will not stop the growth of the tables & matrices, what it does is ensure that the layout of the rest of the report items are not thrown out at run time.”

    Is there any other way to achieve this, i.e. we have a table on A4 size paper report that needs to start writing at specified location and should only grow to a max limit within the page, the remaining data need to be written from the same top location on the next page and so on.

    Thanks in advance,

    PY

  8. Glad I found this post, alignment of multiple charts next to a tablix was driving me nuts. This solved the problem, thanks!

  9. Hi, I have something to ask. I try to move a textbox to decrease the gap between the objects in the report. It does move when I move it a bit. However, when I move it further, even till it overlaps with other objects, it will not move, the position remains the same. Hence, the gap is too big. I previously used Crystal Report; there, we can just uncheck the “Align to Grid” attribute, and arrange the objects as we want. I don’t know how to do this in Reporting Services. Do you know how to achieve this?

    Thank you

    • Hi Steven,

      Highlight the text box and then use your left/right/up/down arrows keys to move it to the desired location.
      Use Ctrl+Arrows to move the object in tiny increments.
      Use Shift+Arrows to change height (up/down) or width (left/right) of the object.

  10. Great explanation!!! I’m new to SSRS and it took me more than a day worth of work to find your post!!!!
    it works perfectly!!!!

  11. YEAH!!!!!!

    I almost pulled my hair off on this one. Tried everything but with no success until i found your site! :)

    Thanks!

  12. Just wanted to say thanks for the line in a rectangle workaround – was pulling my hair out a bit!

  13. It’s a nice post. Thanks for your helping idea. In my report there is three tablix together horizontally and 3 charts is underneath. Without your helpful idea, I will have to find way from the scratch after I’ve done all. With your idea, it save my time. Thanks so much… ^-^ :)

  14. Thank you for the tip on moving textboxes in tiny increments! I was getting frustrated that using arrow keys was moving controls in larger increments than I wanted. Time saver tip.

  15. BTW I figured out the line idea too so finding your post confirmed I was doing the right thing! I use one vertical line, hidden to create appearance of fixed height. By your description it sounds like you suggest createing an 90 degree angle to control both height and width? I tryed putting a diagonal line from top left corner to bottom right corner and it acheives the same thing as far as I can tell (but I am not expert). I guess it just depends on what area of the report you want to contrain.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>