Witam,
Mam problem z reporting w c#. Mianowicie tworzę raport i zawsze dodaje mi stronę więcej tzn. raport ma 2 strony a pokazuje 3.
W załącznikach pokazałem jak to wygląda, oraz jak ustawiona jest strona w reporting.
Pokazuje jeszcze kod na wszelki wypadek:
reportViewer1.ProcessingMode = ProcessingMode.Local;
LocalReport localReport = reportViewer1.LocalReport;
reportViewer1.LocalReport.DataSources.Clear(); //clear report
reportViewer1.LocalReport.ReportEmbeddedResource = "Raporting.Report_Promo.rdlc"; // bind reportviewer with .rdlc
Microsoft.Reporting.WinForms.ReportDataSource dataset = new Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", lista); // lista zawiera dane
reportViewer1.LocalReport.DataSources.Add(dataset);
dataset.Value = lista;
string deviceInfo = "<DeviceInfo><PageHeight>8.5in</PageHeight><PageWidth>11in</PageWidth><MarginTop>0.5in</MarginTop> <MarginLeft>0.5in</MarginLeft><MarginRight>0.5in</MarginRight><MarginBottom>0.5in</MarginBottom></DeviceInfo>";
this.reportViewer1.LocalReport.Render("PDF", deviceInfo);
System.Drawing.Printing.PageSettings ps = new System.Drawing.Printing.PageSettings();
ps.Landscape = true;
ps.Margins.Left = 0;
ps.Margins.Right = 0;
ps.Margins.Top = 0;
ps.Margins.Bottom = 0;
System.Drawing.Printing.PaperSize size = new System.Drawing.Printing.PaperSize();
ps.PrinterSettings.DefaultPageSettings.Landscape = true;
this.reportViewer1.SetPageSettings(ps);
this.reportViewer1.PrinterSettings.DefaultPageSettings.Landscape = true;
reportViewer1.LocalReport.Refresh();
reportViewer1.RefreshReport(); // refresh report