Search code examples
c#winformsreportingreportviewerrdlc

Print preview using report viewer makes extra page with blank


I am trying to get a report from my items.I make my report by Rdlc file using visual studio 2012.

I fetch my data using this code:

            List<InvoiceDetailRPT> list = customerRpt.ReturnListOfInvoiceDetailsForGRV(invoiceDetails);
  Microsoft.Reporting.WinForms.ReportDataSource dataset =
                new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", list);
            reportViewer1.LocalReport.DataSources.Add(dataset);
            dataset.Value = list;

            reportViewer1.LocalReport.Refresh();
            reportViewer1.RefreshReport(); // refresh report

Everything works fine but in print preview i have a big problems.For example in each page i should show 6 items ,if the items is more that 6 ,the reporter should makes another page for that.But when my items is less than 6 the reporter makes another age with blank !!!and another problem when my records is more that 6 it creates 4 pages and the pages 2 and 4 are blank .why ?

For example here in the pictures my result has 9 items and the result is like this :

enter image description here

Page 2 is blank like this:

enter image description here

Page 3 shows items with 7 8 9 number

enter image description here

And the last one is blank again

enter image description here

It means for each pages it makes a blank page why ?

best regards


Solution

  • Examine your report size values and margin values. If page width plus margin width at any point is bigger than set page size, it will push the "extra" white space into the next blank page. Same goes for page height.

    So, the first thing to do is to delete any white space at the bottom and left and right sides of the page in report designer, set report size to exact page size or smaller and set margins in such a way that the report body + margins are not bigger than set page size.