set page layout for report viewer in visual studio 2010

前端 未结 3 1849
既然无缘
既然无缘 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();
    

提交回复
热议问题