set page layout for report viewer in visual studio 2010

前端 未结 3 1850
既然无缘
既然无缘 2021-02-01 09:04

I again have a little problem. I have used ReportViewer in my Windows Form Application in visual studio 2010. The width of my report id about 7 inches. When i view the report in

相关标签:
3条回答
  • 2021-02-01 09:11

    you can use below code:

     System.Drawing.Printing.PageSettings pg=new System.Drawing.Printing.PageSettings();
     pg.Margins.Top = 0;
     pg.Margins.Bottom = 0;
     pg.Margins.Left = 0;
     pg.Margins.Right = 0;
     System.Drawing.Printing.PaperSize size = new PaperSize();
     size.RawKind = (int)PaperKind.A5;
     pg.PaperSize = size;
     reportViewer1.SetPageSettings(pg);
     this.reportViewer1.RefreshReport();
    
    0 讨论(0)
  • 2021-02-01 09:36
    ReportViewer rpt = new ReportViewer();
    rpt.SetPageSettings(new System.Drawing.Printing.PageSettings() { Landscape = true });
    
    0 讨论(0)
  • 2021-02-01 09:38

    Use pg.LandScape = true along with you existing,

        pg.Margins.Top = 0;
        pg.Margins.Bottom = 0;
        pg.Margins.Left = 0;
        pg.Margins.Right = 0; 
        pg.LandScape = true
    
    0 讨论(0)
提交回复
热议问题