Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 419
Mehrdad Avatar asked Dec 15 '22 21:12

Mehrdad


2 Answers

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.

like image 103
InitK Avatar answered Dec 28 '22 09:12

InitK


You can also set the ConsumeContainerWhitespace property of the parent report to true. That's worked for me.

Check the documentation here.

like image 21
Thiago Rebouças Avatar answered Dec 28 '22 07:12

Thiago Rebouças