0

I have seen some mind-binding situations with SSRS reports in my few years of using it, and I've been able to design around most issues and get it to do everything I've been asked to do.

But apparently, not something extremely simple!

I'm using Visual Studio 2019 version 16.7.2 with the Microsoft SQL Server Reporting Services Designers version 15.0.19124.0 installed. There's no data bound to the report, this is just a simple design concept.

I have a report that has a static custom page size (in centimetres), interactive size and no margins (12.8 x 17.8cm). The body size is deliberately set to make it a two page report (2 x the page height).

'ConsumeContainerWhiteSpace' on the report properties is set to true.

Page 1 has an image, consuming the entire space of Page 1 (size of 12.8 x 17.8), with a Text box placed near the bottom right of the image (overlaying it, but not exceeding the width or height of the page, and is set to not grow).

Page 2 is exactly the same, with the content starting where Page 2 would and should start (0, 17.8). However, the Page 2 content is set to hidden (hidden = true, on both the image and the textbox).

When previewed, the report renders two pages, one of which is blank.

If I take the Page 2 content textbox off, and preview it, the report renders as one page (as I need it to).

The same issue occurs if I replace the textbox with a Rectangle or Tablix (the two objects I really need to use in this report as well as the textbox located where it is) and set them to hidden.

Moving any of these objects to the top of Page 2, still results in the same behaviour.

It seems that certain objects, despite being hidden, have space allocated that can't be 'rolled up / truncated / shrunk'. Is this 'by design behaviour'?

Is there some form of magic-witch-craftery I'm missing here to get this to work, or simply something I'm not understanding... ?

Thanks for reading!

Note: So far I have tried the 'Switch to inches, then back to centimeters' solution mentioned in other posts along these lines, have varied 'Keep together' properties, checked 'CanGrow' and 'CanShrink' property changes - all of which have not helped find a solution.

VorTechS
  • 473
  • 5
  • 12
  • This is likely a product of the items overlaying each other, but is hard to determine without any screenshots of your design. In these situations I usually set the various elements to have brightly different and contrasting background or border colours to see where their bounds are in the rendered preview. It is also worth noting that the various render options (Preview. HTML, Excel, PDF, Image, etc) also all render slightly differently, so whilst your preview may be incorrect, the rendered PDF (for example) may be correct. – iamdave Sep 18 '20 at 12:02
  • @iamdave Page 1 renders perfectly, with everything in place, exactly where it should be. An exported PDF mirrors what I see in the Preview, in both cases. In outline view, as you say, there's a different rendering, where the components don't appear overlayed, but that's as expected. – VorTechS Sep 18 '20 at 12:08
  • Page 2 is likely not rendering as you expect due to overruns that are spilling out of the set page area. – iamdave Sep 18 '20 at 12:17
  • I'm willing to concede that is likely the case. In fact, now the preview is doing exactly the same thing just with the two images. – VorTechS Sep 18 '20 at 12:20
  • It isn't really a matter of conceding and I am not saying that is *definitely* the problem. If you highlight the individual report items per my comment above using backgrounds or borders you will be able to see definitely whether or not the issue is overruns. – iamdave Sep 18 '20 at 12:24
  • Well, I'm down to 2 images, re-sized so they definitely fit inside the page-bounds (half the size of the page width/height) and still there's 2 pages rendered! Time to try with some coloured rectangles using the same logic – VorTechS Sep 18 '20 at 12:41
  • Well, I stripped everything down to one rectangle, half the size of a single page height and width, with 2 pages rendered and exported. The body size appears to be staying static and not shrinking... proven when I removed the only thing on the report, and still ended up with 2 pages! – VorTechS Sep 18 '20 at 13:02
  • Your report body will not shrink, make it as large as is needed to hold all your report items. You can control page breaks, as the name would suggest, via page breaks added to your report items. A report design that has a 1cm image with a page break after with another 1cm image directly below it will render onto two identical pages regardless of whether your report body is set to 2cm or 10cm. – iamdave Sep 18 '20 at 13:09
  • Gotcha. So the issue being that I'm applying objects directly to the surface of the body (which as you say won't shrink), instead of using a suitable container that should stay the size of desired page and repeat/hide content as needed? (As I need to hide the Page 2 content on condition) – VorTechS Sep 18 '20 at 13:15
  • Sounds about right, but again, hard to really tell without more details on your situation – iamdave Sep 18 '20 at 13:27
  • Yea. It clears up why I am seeing what I'm seeing. Now I've got some work to go about implementing what's needed.... Please feel free to stick a proper answer suggesting I don't use the body, so that I can give you the reputation that's deserved ...! – VorTechS Sep 18 '20 at 13:34

1 Answers1

0

The report body should be set at most wide enough to fit on your output page and long enough to hold all your report items. When you want different items to appear on a new page, put them in a container with a page break set either before or after (whichever is most appropriate). This can also be handled in a data driven manner using page breaks on table groups.

There is no requirement to have white space within your report design to 'fill up' the rest of the page on the rendered report.

If you want anything to appear at the bottom of the report, simply put it in the footer section. If you want specific things to appear at the bottom of the page of different heights on different pages, that is more of a challenge and will usually require some clever data driven spacers within the report body.

iamdave
  • 12,023
  • 3
  • 24
  • 53