Search code examples
reporting-servicesrdlc

RDLC Report Hidden rectangles Creates Empty Pages


I found a similar question on the link: rdlc-report-hidden-charts-creates-empty-pages, but it didn't helped.

I have two sections that needed to be hidden when data is not present. however after adding a new section in the accident info section I am getting the error. My page size is 8.27in, 11.69in. Interactive size is 8in, 11in.

On that section previous height was 7.8 inch now its increased to 8 inch. After subtracting header and footer 8.4 inch space is available for the page. if margin is considered only 0.1 inch margin is there for all sides. ConsumeContainerWhitespace is also true.

For some data where these two rectangles are not visible an empty page is generated. This should not be the case as after hiding them from expression widget moves up automatically. On some sections property "PageBreak" is set to BreakLocation=Start. It is because some sections needs to be saved in a new page.

page before break

enter image description here

Page after break

enter image description here

here is the sample code for RDLC

<?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
  <ConsumeContainerWhitespace>true</ConsumeContainerWhitespace>
  <rd:ReportUnitType>Inch</rd:ReportUnitType>
  <rd:ReportID>38832df4-093b-4332-b811-4e31095617ec</rd:ReportID>
</Report> 

Sorry I am unable to load my full RDLC as the body limit is exceeded. I am using reporting version 8.


Solution

  • Firstly I would like to thank @HardcoreGamer for support. In this case I tried with only Tablix widget with row visibility and widget visibility based on expression. None of the approach worked. I had got one concept wrong that on hiding the widget or Tablix report takes no space. The report takes space which is between the widgets. I also tried with two different schema as well i.e. RDL 2008 and 2016 but same thing happened on both. I posted similar question on Microsoft form as well : RDLC Report Hidden rectangles Creates Empty Pages

    What finally worked is that I reduced the rectangle of previous page by a margin of 1 inch excluding padding, page margin and footer for A4 size page. The space between the widgets was 0.5 inch. for hiding two widgets additional space of 1 inch is required, so that a new page doesn't gets generated.

    Final image with changes

    I still have to find a way out if data increases then the new page dosent get generated.